2011-08-18 90 views
0

我有兩個div彼此相鄰,一個用float: right,另一個用float: left。左邊的那個包含一個圖像(200x100px),右邊的div應該包含一個文本。我希望div右邊的文本從div的左下角開始,而不是左上角,有可能嗎? 感謝將div中的文本對齊到底部

回答

2

您可以製作容器position: relative然後在裏面製作一個div 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> 
0

嘗試在跨度,段落或任何你放置文本在這個CSS規則:

vertical-align: bottom; 
+0

我認爲在沒有顯示的某些瀏覽器中可能會出現問題:表格 – mkk

0

你可以嘗試添加到您的div這個CSS:

#rightDiv{ 
    display: table; 
    vertical-align: bottom; 
}