[英]How to stretch vertical div element to fill parent container?
I have the following JS Bin 我有以下JS Bin
<div class="container">
<div class="column">
<div class="cell">Top left</div>
<div class="cell">Top left bottom</div>
</div>
<div class="column">
<div class="cell">Center</div>
</div>
<div class="column">
<div class="cell">Top right</div>
<div class="cell">Top right bottom</div>
</div>
</div>
How can I make vertical aligned divs without explicit setting of height and position to absolute to look like the following: 如何在不将高度和位置显式设置为绝对的情况下使垂直对齐的div看起来如下所示:
EDIT: Please don't suggest me using of tables because I need to resolve my problem in the example above. 编辑:请不要建议我使用表格,因为我需要在上面的示例中解决我的问题。
How about using CSS tables with your current markup: 如何在当前标记中使用CSS表 :
.container {
display: table;
}
.column {
display: table-cell;
vertical-align: top;
}
.cell {
border: 1px solid #000;
width: 100px;
font-size: 13px;
}
.column:nth-child(2)
{
border: 1px solid #000;
}
.column:nth-child(2) .cell
{
border: none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.