通过设置margin-bottom跟padding-bottom绝对值相同
padding-bottom:200px;
margin-bottom:-200px;
能达到同高
html代码
<div id="wrap">
<div id="left">
<p style="height:50px">style="height:50px"</p>
</div>
<div id="center">
<p style="height:100px">style="height:100px"</p>
</div>
<div id="right">
<p style="height:200px">style="height:200px"</p>
</div>
</div>
css代码
#wrap{
overflow:hidden;
width:580px;
border: 2px solid black;
}
#left,#center,#right{
padding-bottom:200px;
margin-bottom:-200px;
}
#left {
float:left;
width:140px;
background:#777;
}
#center {
float:left;
width:300px;
background:#888;
}
#right {
float:right;
width:140px;
background:#999;
}
p {color:#FFF;text-align:center; margin:0;}
其中wrap要设置overflow:hidden,清除float,使wrap包裹里面的div,也把超出的隐藏起来。