基本上我在圖像中有一個標題。您可以從下面的代碼和示例中注意到,我已經設置了一個負邊距頂部,將其放置在圖像中靠近底部的位置。問題是文本的位置/方向是從上到下。這意味着標題越多,文字越長,到底部。我想讓它反轉 - 以便文本div根據其大小將文本擴展到頂部。來自底部的文本位置
可能嗎?先謝謝你。
這裏是例子http://jsfiddle.net/j7gLd/
HTML
<div class="image">
<img src="image.jpg">
<div class="title">This is a title</div>
</div>
<div class="image">
<img src="image.jpg">
<div class="title">This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title</div>
</div>
CSS
.image {
width: 800px;
height: 530px;
margin: 10px;
}
.title {
position: absolute;
background-color: #CCC;
max-width: 600px;
margin-top: -80px;
padding: 5px;
}
改變圖像的位置是:相對於爲好。 – KnowHowSolutions