我正在顯示15張圖片的列表。根據圖像的寬度(是圖像寬度變化)和屏幕大小的寬度,每行可能有不同數量的圖像。如果空間有限,請將元素添加到html
例如,我有3行4個圖像和1行3個圖像的情況。現在在最後一行,有一個空的空間。我怎樣才能添加一些元素或文本到最後一行的空白處,並且只有它是空的?所以如果我有3行15個圖像,我不應該看到我添加的元素。
這是我的HTML的外觀:
<div class="view-content">
<div class="views-row views-row-1"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-2"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-3"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-4"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-5"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-6"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-7"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-8"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-9"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-10"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-11"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-12"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-13"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-14"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
<div class="views-row views-row-15"><a href="#"><img src="http://www.example.com/image.jpg /><a/></div>
</div>
img高度或寬度是絕對的嗎? –
@Jonasw不,它不是。 – albertski
但該行必須具有絕對高度 –