【发布时间】:2013-11-13 19:36:48
【问题描述】:
我正在尝试使浮动 div 具有填充父 div 的高度。
http://jsfiddle.net/sergep/2qPZ2/1/
结构如下:
Parent div______________________
| Middle child
| Left child - float:left
| Right child - float:right
问题是左边的子元素比右边的文本少,这意味着右边增加了父div的高度(以适应div),但左边的浮动div没有效仿。
css 看起来像这样:
.bottomcontainer {
bottom: 0;
position: absolute;
width: 100%;
height: auto;
}
.bottomleft {
background: #346CA5;
float:left;
width: 50%;
}
.middle {
background: #FFCE3C;
}
.bottomright {
background: #65B237;
float:right;
width: 50%;
}
如何使蓝色的.bottomleft 类粘在.bottomcontainer 的底部? - 我正在尝试做出响应,所以我不想使用实际的像素大小!
因此,如何使里面的文字垂直居中?
【问题讨论】: