![](/img/trans.png)
[英]How can I have text resize based on the width of the preceding div element using CSS?
[英]How can I show the text at the bottom of a child div using css? I have tried, but the text goes to main div
如何使用 css 將文本放在特定 div 的底部? 我試過了,但文本轉到主 div
<div id="img1" style="background-color:red;width:100%;height:100%;">
<div id="abc">
<img id="image" src="punj.jpg" alt="PUNJ icon" style="width:5%; height:15%; float:left;">
</div>
<div id="img1" style="background-color:#B1C7E8;width:95%;height:15%; float :left;">
<h1 id="head">
University
</h1>
</div>
這是html的代碼
您的最后一個 div 沒有關閉 div,並且您為圖像本身提供了高度和寬度,而不是包含它的 div。 我會為您正在嘗試做的事情設置 div 而不是圖像的樣式。
<div id="abc"style="width:5%; height:15%;" >
<img id="image" src="punj.jpg" alt="PUNJ icon" float:left;>
</div>
<div id="img1" style="background-color:#B1C7E8;width:95%;height:15%; float :left;">
</div>
<div>
<h1 id="head">
University
</h1>
</div>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.