[英]aligning the text in a div to the bottom
我有兩個div,彼此相鄰,一個是float: right
,另一個是float: left
。 左邊的那個包含一個圖像(200x100px),右邊的div應該包含一個文本。 我想讓右邊的div文本從div的左下角而不是左上角開始,這有可能嗎? 謝謝
您可以使容器position: relative
然后在position: absolute; bottom: 0; left: 0;
里面創建一個div position: absolute; bottom: 0; left: 0;
position: absolute; bottom: 0; left: 0;
<div style="position: relative; height: 300px; width: 300px; background-color: #f00;">
<div style="position: absolute; bottom: 0; left: 0; right: 0; background-color: #00f;">
This will be at the bottom!
</div>
</div>
在跨度,段落或您放置文本的任何內容上嘗試此css規則:
vertical-align: bottom;
你可以嘗試添加到你的div這個CSS:
#rightDiv{
display: table;
vertical-align: bottom;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.