.top{width:100%;height:50px;background:gray;}
.main{width:100%;height:300px;background:red;}
.left{width:30%;height:300px;background:blue;float:left;}
.right{width:68%;height:300px;background:green;float:right;}
.foot{width:100%;height:30px;background:orange;clear:both;}
.main{width:100%;height:300px;background:red;}
.left{width:30%;height:300px;background:blue;float:left;}
.right{width:68%;height:300px;background:green;float:right;}
.foot{width:100%;height:30px;background:orange;clear:both;}
最赞回答 / 慕粉3724715
<div class ="main"><div class ="left"></div><div class="right"></div></div>是这样,要包起来的
2016-09-24
因为main包含的块全都设置了浮动,而浮动和绝对定位会使块脱离标准文档流,但是head仍在文档流中 所以foot会忽略main的所有块而贴着head块
方法1: .main{
width:860px;height:600px;margin:0 auto;background:#9FC;}
方法2:.footer{ height:50px; background:#9F9; margin:600px 0 0 0;}
方法3:.footer{width:100%; height:50px; background:#9F9; position:absolute;top:700px;}
方法1: .main{
width:860px;height:600px;margin:0 auto;background:#9FC;}
方法2:.footer{ height:50px; background:#9F9; margin:600px 0 0 0;}
方法3:.footer{width:100%; height:50px; background:#9F9; position:absolute;top:700px;}
.top{height:100px; background:gray;}
.main{height:300px; background: red; position:relative;}
.left{width:200px;height:300px;background:blue;position:absolute;top:0;left:0;}
.right{height:300px;background:green;position:absolute;width:100%;top:0;left:210px;}
.foot{height:100px; background:orange;}
.main{height:300px; background: red; position:relative;}
.left{width:200px;height:300px;background:blue;position:absolute;top:0;left:0;}
.right{height:300px;background:green;position:absolute;width:100%;top:0;left:210px;}
.foot{height:100px; background:orange;}