高度自动相等方法

1、margin 为负值

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>
决定高度那个放在最后
 
2、min-height  自动撑大高度
ie6配合  _height     hack
 
3、使用背景图片垂直平铺

posted on 2016-01-26 17:03  迷茫小飞侠  阅读(179)  评论(0编辑  收藏  举报

导航