【发布时间】:2013-08-13 08:31:39
【问题描述】:
我正在尝试使用 bootstrap 3 RC1 垂直对齐表格单元格中的两个 div。我已经应用了垂直对齐类,但我错过了什么?在这里启动:http://bootply.com/73625
HTML
<div class="content">
<div class="col-lg-6 col-md-6 col-12 child1">Child content</div>
<div class="col-lg-6 col-md-6 col-12 child2">Child content</div>
</div>
CSS
.content{
position:absolute;
top:40px;
bottom:0px;
width:100%;
border:4px solid green;
display:table-cell;
vertical-align:middle;
}
.child1{
border:4px solid blue;
}
.child2{
border:4px solid red;
}
【问题讨论】:
-
绝对定位元素会否定
display: table-cell;,因为它会自动使元素成为块级。 -
什么位置可以达到我正在寻找的 100% 高度?
-
Relative 显然行不通:bootply.com/73644
标签: css twitter-bootstrap vertical-alignment twitter-bootstrap-3