对于我正在处理的应用程序,我需要等高的列。我选择使用 CSS 将我的列项设置为表格的样式。这样每列的高度确实是列高中的最大值。
在此处查看示例:http: //jsfiddle.net/roelvd/GXe9m/
现在每列的高度在每个浏览器中确实是 100%。然而,直接在每一列中的元素(在我的例子中是 .container)也应该是 100%。这在 Firefox 和 Chrome 中都可以正常工作;但在 IE10 中没有(很可能是较旧的 ID 版本)。
HTML:
<div id="wrapper" class="table">
<div class="row">
<div class="column" style="width: 20%">
<div class="container empty"></div>
</div>
<div class="column" style="width: 50%">
<div class="container">
<div class="element"><p>Text</p></div>
<div class="element"><p>And more text. An complete paragraph actually.</p><p>And another one!</p></div>
<div class="element"><p>And this is even more text.</p></div>
</div>
</div>
<div class="column" style="width: 30%">
<div class="container">
<div class="element"><p>And this is even more text.</p></div>
</div>
</div>
</div>
</div>
CSS:
#wrapper {
width: 600px;
}
.table {
display: table;
height: 100%;
}
.row {
display: table-row;
height: 100%;
}
.column {
display: table-cell;
height: 100%;
vertical-align: top;
}
.container {
height: 100%;
margin: 0;
}
.container.empty {
background-color: yellow;
}