2016-11-18 77 views
2

我有縮略圖的一排這樣的:引導3頁高度相等的縮略圖(如在引導4相等的高度卡)

我想他們是相等的高度雖然。這是我的代碼:

<div class="row text-center"> 
    <div class="col-md-3 col-sm-6"> 
     <div class="thumbnail"> 
      <div class="caption"> 
       <h3>HOTKEY + COMBO</h3> 
       <p>Hotkey description goes here. Category only shown in explore.</p> 
       <p> 
        <a href="#" class="btn btn-default" data-tooltip="Change Hotkey"> 
       </p> 
      </div> 
     </div> 
    </div> 
    <div class="col-md-3 col-sm-6"> 
     <div class="thumbnail"> 
      <div class="caption"> 
       <h3>HOTKEY + COMBO</h3> 
       <p>short desc</p> 
       <p> 
        <a href="#" class="btn btn-default" data-tooltip="Change Hotkey"> 
       </p> 
      </div> 
     </div> 
    </div> 
    <div class="col-md-3 col-sm-6 hotkey-add"> 
     <div class="thumbnail"> 
      <div class="caption"> 
       <p></p> 
       <p><a href="#" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></a></p> 
      </div> 
     </div> 
    </div> 
</div> 

這可能嗎?就像我們在bootstrap4在這裏看到的是高度相等卡:

http://www.codeply.com/render/KrUO8QpyXP#

回答

5

我知道我有點晚,但我認爲最好的方法是Flexbox的。下面是它如何在引導3工作:

.row.display-flex { 
    display: flex; 
    flex-wrap: wrap; 
} 
.thumbnail { 
    height: 100%; 
} 

只需添加display-flex到含row。此外,即將推出的Bootstrap 4將flexbox作爲默認設置,因此未來將不再需要這些額外的CSS。

​​

您還可以做更多與position of child elements


而且看, make Bootstrap columns all the same height

+0

感謝Zim爲此。我避免使用彈性框,因爲瀏覽器對此功能的支持很弱,不是嗎? – Noitidart