-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
纯CSS实现侧边栏/分栏高度自动相等
核心代码:
margin-bottom:-3000px; padding-bottom:3000px;再配合父标签的overflow:hidden属性即可实现高度自动相等的效果
#content{overflow:hidden;}
.left{width:200px; margin-bottom:-3000px; padding-bottom:3000px; background:#cad5eb; float:left;}
.right{width:400px; margin-bottom:-3000px; padding-bottom:3000px; background:#f0f3f9; float:right;}
.center{margin:0 410px 0 210px; background:#ffe6b8; height:600px;}
<div id="content">
<div class="left">左边,无高度属性,自适应于最高一栏的高度</div>
<div class="right">右边,无高度属性,自适应于最高一栏的高度</div>
<div class="center">中间,高度600像素,左右两栏的高度与之自适应</div>
</div>