我試圖創建一個尺寸爲900x420的3幅圖像的橫幅,如底部的圖片。林想知道如何讓他們對齊,每個圖像以某種方式水平居中。任何建議,將不勝感激: a busy cat http://i62.tinypic.com/208u0is.png覆蓋和中心圖像css
到目前爲止,我有這個與Twitter的引導:
<div class="container-fluid">
<div class="img-holder">
<img src="img/rm1.jpg" alt="" />
<div class="caption">
<h3 class="title-content">Caption goes here<h3>
</div>
</div>
<div class="img-holder">
<img src="img/rm2.jpg" alt="" />
<div class="caption">
<h3 class="title-content">Caption goes here<h3>
</div>
</div>
<div class="img-holder">
<img src="img/rm3.jpg" alt="" />
<div class="caption">
<h3 class="title-content">Caption goes here<h3>
</div>
</div>
</div>
CSS:
.img-holder {
float: left;
position: relative;
background - color: rgba(2, 85, 165, 0.36);
}
.img-holder.caption {
display: inline - block;
position: absolute; /* absolute position (so we can position it where we want)*/
bottom: 0 px; /* position will be on bottom */
left: 0 px;
right: 0 px;
width: 100 % ;
/* styling bellow */
background - color: rgba(0, 0, 0, 0.76);
color: white;
}
h3.title_content {
padding: 10 px;
margin: 0 px;
}
嗯,這是安靜的關閉,但正如你所看到的圖像疊加在某種程度上,我不認爲你需要指定一個容器的寬度。你可以看到每個圖像都是900x420,它們覆蓋的方式有什麼變化 – 2014-10-27 21:48:13
你是說你想讓標題位於圖像的中心嗎? – Sai 2014-10-27 21:50:32
號碼字幕在這裏沒有任何事情要做。你在你的例子中做過的同樣的事情,圖片尺寸爲900x420,而不是450x210,需要將所有圖片以某種方式疊加在一起,才能正確修復 – 2014-10-27 21:55:42