1
我正在嘗試使用Bootstrap創建兩列行。第一列應該有一個灰色的背景色。我似乎無法讓col-xs- *擴展到行高度的100%。可變高度列,背景顏色
小提琴可以在這裏看到: http://jsfiddle.net/Kikketer/6AM4J/
有兩種方法,我想這樣做:
- 有第一列有灰色的背景,並將其擴展到100%高度(不起作用)。
- 使.row類具有灰色,並使第二列用白色背景覆蓋它。
-HTML:
<div class="ex_wrapper">
<div class="ex_1_row row">
<div class="ex_1_key col-xs-6">Some Content</div>
<div class="ex_1_val col-xs-6">Lots of content that causes a wrap</div>
</div>
<div class="ex_1_row row">
<div class="ex_1_key col-xs-6">Another Header</div>
<div class="ex_1_val col-xs-6"></div>
</div>
</div>
-CSS:
/** Example 1 would just have the key highlight in grey **/
.ex_1_key {
background-color: lightgrey;
height: 100%; /** notice the 100% doesn't seem to work **/
}
/** Example 2 colors the whole row, and covers things in white **/
.ex_2_row {
background-color: lightgrey;
}
.ex_2_val {
background-color: white;
}
這些方法都失敗。我目前使用選項#2,但是當該值沒有內容時,該字段顯示爲大多灰色(因爲它的高度小於該鍵)。
這裏是什麼,我試圖做一個形象:
有沒有人有這個問題?你做了什麼來解決這個問題?改變數據並不是一個真正的選擇。
你能不適用像'最小高度:1EM;'到你的價值領域?否則,在使用'flexbox'之外,您可能不得不求助於在您的行上平鋪背景圖像。 –
最小高度的工作,有點......我想另一個測試用例,我沒有在這裏(我不擔心)是如果關鍵是跨越多行。基本上,最小高度必須根據鑰匙的實際高度而改變。 – Chris
感謝您的形象。幫助我們知道你到底需要什麼。見下面的解決方案。 –