如何讓列內的圖像具有相同的高度?Bootstrap - 使列內的圖像具有相同的高度?
我正在嘗試製作像這樣的網格佈局site。
這是我的嘗試bootsrap。
但我不能做出高度一致的:
代碼:
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"><a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x1200" alt=""> </a>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"><a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x1200" alt=""> </a>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
<div class="col-md-12 col-sm-12"> <a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x600" alt=""> </a>
</div>
</div>
<div class="col-md-3 col-sm-3">
<div class="col-md-12 col-sm-12"><a href="#" class="grid-item"> <img class="img-responsive" src="http://placehold.it/800x1200" alt=""> </a>
</div>
</div>
</div>
</div>
有什麼事情,我需要做的像側?如果是這樣,我應該遵守什麼尺寸的圖像?
或者它是我應該在JavaScript端或CSS的東西?
或者我應該使用一個插件?
任何想法?
你試過了'.row-eq-height'類的bootstrap嗎? http://getbootstrap.com.vn/examples/equal-height-columns/正在使用flexbox –
@MihaiT使列具有相同的高度。我尋找使圖像具有相同的高度。 – laukok
也就是說,當你在較小的屏幕上時,'.row-eq-height'會導致一個bug。它強制3列保持不變,即使你在大屏幕和中屏幕上使用col-md-4,也希望這3列在小屏幕上成爲1列。 – laukok