.top{width:100%; height:60px; background:#ccc;}
.main{width:100%; height:300px; background:red;}
.left{width:28%; height:300px; float:left; background:blue;}
.right{width:70%; height:300px; float:right; background:green;}
.foot{width:100%; height:40px; background:orange; clear:both; }
.main{width:100%; height:300px; background:red;}
.left{width:28%; height:300px; float:left; background:blue;}
.right{width:70%; height:300px; float:right; background:green;}
.foot{width:100%; height:40px; background:orange; clear:both; }
已采纳回答 / 慕婉清3660285
position:absolute;的top,left等属性使用是相对于这个定义最近一个要有定位属性的父级元素,如果不存在这样的父级则作用于body元素,也就是浏览窗口。
2016-04-26
有没有更简洁的
.top{background:grey; width:100%;}
.main{background:red; width:100%;}
.left{background:blue; height:600px; width:200px;}
.right{background:green; position:absolute; float:right; margin-left:210px; height:600px; width:100%;}
.foot{background:pink; width:100%;}
.top{background:grey; width:100%;}
.main{background:red; width:100%;}
.left{background:blue; height:600px; width:200px;}
.right{background:green; position:absolute; float:right; margin-left:210px; height:600px; width:100%;}
.foot{background:pink; width:100%;}
.top{background:grey; width:100%;}
.main{ height:600px; width:100%; background:red; position:relative;}
.left{ background:blue; height:600px; width:200px; }
.right{ background:green; position:absolute; float:right; margin-left:210px; height:600px; width:100%;}
.foot{ background:pink; width:100%;}
.main{ height:600px; width:100%; background:red; position:relative;}
.left{ background:blue; height:600px; width:200px; }
.right{ background:green; position:absolute; float:right; margin-left:210px; height:600px; width:100%;}
.foot{ background:pink; width:100%;}
.top{ height: 100px; background: gray;}
.main{ background-color: red;}
.left{height: 600px; width: 200px; background-color: blue; }
.right{height: 600px; width: 100%; background-color: yellow; float:left;
margin-left: 210px;}
.foot{height: 100px; background-color: purple; clear: both;}
.main{ background-color: red;}
.left{height: 600px; width: 200px; background-color: blue; }
.right{height: 600px; width: 100%; background-color: yellow; float:left;
margin-left: 210px;}
.foot{height: 100px; background-color: purple; clear: both;}
<div class="big_right">
<div class="right">right</div>
</div>
.main{height:600px; background-color:red; width:100%;}
.left{height:600px; width:200px; background-color:blue; float:left;}
.right{height:600px; width:100%; background-color:yellow; float:right;}
.big_right{margin-left:210px;}
<div class="right">right</div>
</div>
.main{height:600px; background-color:red; width:100%;}
.left{height:600px; width:200px; background-color:blue; float:left;}
.right{height:600px; width:100%; background-color:yellow; float:right;}
.big_right{margin-left:210px;}