使用Bootstrap。我希望頂部div根據內容和底部div來固定高度,以填充父級的剩餘高度。總高度應爲100%。Bootstrap - 填充列的重新調整高度
HTML:
<div class="container-fluid">
<div class="row">
<div class="col-lg-2">
<div id="test">
<div>
Fixed height according to content.
</div>
<div class="fill">
Rest of the height
</div>
</div>
</div>
</div>
</div>
CSS:
html, body{
height: 100%;
}
.container-fluid, .row, .col-lg-6, #test{
height: 100%;
}
.fill {
background-color: #FF0000;
height: 100%
}
但是它看起來像底部的div是完全100%和溢出。這個想法也是會有幾個專欄。
在此先感謝!
小提琴:https://jsfiddle.net/eb8v57pe/4/
如果你想等高列,你應該考慮的CSS顯示錶/表單元格屬性。如果這是您的選擇,也有JavaScript解決方案。 –