.top{width:100%; height:50px;background:gray;}
.main{width:100%; height:300px;background:red;}
.left{width:200px;height:300px;background:blue;position:absolute;}
.right{margin-left:210px;width:100%;height:300px;background:green;position:absolute;}
.foot{width:100%; height:50px;background:#369;}
.main{width:100%; height:300px;background:red;}
.left{width:200px;height:300px;background:blue;position:absolute;}
.right{margin-left:210px;width:100%;height:300px;background:green;position:absolute;}
.foot{width:100%; height:50px;background:#369;}
.top{height: 100px;background:gray;}
.main{height: 800px; background:red; }
.left{width:200px;height: 800px;float:left;background:blue;}
.right{height: 800px;position:absolute;left:0;top:100px;right:0;background:green;margin:0 0 0 210px;}
.foot{height: 100px;background:gray;}
.main{height: 800px; background:red; }
.left{width:200px;height: 800px;float:left;background:blue;}
.right{height: 800px;position:absolute;left:0;top:100px;right:0;background:green;margin:0 0 0 210px;}
.foot{height: 100px;background:gray;}
上面的代码没有给main设置高度,而main里的内容又设置成了浮动,所以footer会跑到head的下面。
解决方法有3个:1.清除浮动, clear:both;
2.为main设置高度, .main{
width:860px;height:600px;margin:0 auto;background:#9FC;
}
3 footer自己设置margin高度600px:
.footer{ height:50px; background:#9F9; margin:600px 0 0 0;}
解决方法有3个:1.清除浮动, clear:both;
2.为main设置高度, .main{
width:860px;height:600px;margin:0 auto;background:#9FC;
}
3 footer自己设置margin高度600px:
.footer{ height:50px; background:#9F9; margin:600px 0 0 0;}