.head,.main{ width:960px;margin:0px auto;}
.left{ width:220px; height:600px; background:#ccc;float:left;}
.r_sub_left{ width:540px; height:600px; background:#9C3; float:left}
.r_sub_right{ width:200px; height:600px; background:#9FC; float:right;}
.footer{ height:50px; background:#9F9;clear:right;}
.left{ width:220px; height:600px; background:#ccc;float:left;}
.r_sub_left{ width:540px; height:600px; background:#9C3; float:left}
.r_sub_right{ width:200px; height:600px; background:#9FC; float:right;}
.footer{ height:50px; background:#9F9;clear:right;}
.top{height:100px;
background:black;}
.main{height:400px;background:red;}
.left{height:400px;width:40%;background:blue;float:left;}
.right{height:400px;width:59%;background:green;float:right;}
.foot{height:50px;
background:orange;}
background:black;}
.main{height:400px;background:red;}
.left{height:400px;width:40%;background:blue;float:left;}
.right{height:400px;width:59%;background:green;float:right;}
.foot{height:50px;
background:orange;}
.top{height:80px;background-color:#ccc;}
.main{height:300px;background:red;position:relative;}
.left{height:300px;width:200px;float:left;background:blue;}
.right{height:300px;background:#ccffcc;position:absolute;left:210px;right:0px;}
.foot{height:80px;background:#cc3300;}
.main{height:300px;background:red;position:relative;}
.left{height:300px;width:200px;float:left;background:blue;}
.right{height:300px;background:#ccffcc;position:absolute;left:210px;right:0px;}
.foot{height:80px;background:#cc3300;}
已采纳回答 / Newbie_Zou
要加上主div的话你可以把中间的div也设置成绝对块,然后设置左右两边距离。如:.main{width:1000px;}.left{ width:200px; height:600px; background:#ccc;left:0; top:0;position:absolute;}.middle{ height:600px; background:#9CF;position:absolute;right:310px;left:210px;}.right{ height:600px; width:300...
2016-05-26
最新回答 / qq_莳萝泡菜_03359237
设置overflow并不会在该元素上清除浮动,它将清除自己(self-clear)。意思就是,应用了overflow(auto或hidden)的元素,将会扩展到它需要的大小以包围它里面的浮动的子元素(而不是叠了起来(collapsing)).clear:both意思是清除全部浮动,比如left和right元素设置了float时,相当于脱离了文档流,该元素的占位空间自然也就没有了,下面的foot元素就会直接紧挨着在top下方;而使用了clear语句后,就清除了float属性,就会回到最下方的位置。下面那个不...
2016-05-26
已采纳回答 / 种子_fe
浮动使元素脱离正常文档流,“.left”浮动就是左边的div脱离正常文档流,“.right”不设置浮动就还在正常的文档流中,左边300px宽度部分就会被left div遮挡了
2016-05-26
.top{width:100%;height:100px;background:grey;}
.main{height:300px;background:red;}
.left{ width:200px;height:300px;background:blue;margin-top:-300px;float:left;}
.right{height:300px;background:green;margin-left:210px ;}
.foot{width:100%;height:50px;background:orange;clear:both;}
.main{height:300px;background:red;}
.left{ width:200px;height:300px;background:blue;margin-top:-300px;float:left;}
.right{height:300px;background:green;margin-left:210px ;}
.foot{width:100%;height:50px;background:orange;clear:both;}