div+css小疑问。
大家看一下这个left 和right 共同被一个#maincontainer div包裹。
代码如下。
#left
{
background: #eee;
width: 350px;
height: 400px;
float: left;
}
#right
{
background: #ccc;
width: 150px;
height: 400px;
float: right;
}
#maincontainer
{
width: 500px;
overflow: auto;
}
#foot
{
background: #eee;
width: 500px;
height: 100px;
}
<div id="maincontainer">
<div id="left"></div>
<div id="right"></div>
<div class="clear"></div>
</div>
<div id="foot"></div>
.clear{clear:both;background: none;border: 0;display: block;float: none;font-size:0;margin:0;padding:0;overflow: hidden;visibility: hidden;width:0px;height:0px;line-height:0px;}
#left
{
background: #eee;
width: 350px;
height: 400px;
float: left;
}
#right
{
background: #ccc;
width: 150px;
height: 400px;
float: right;
}
#maincontainer
{
width: 500px;
overflow: auto;
}
#foot
{
background: #eee;
width: 500px;
height: 100px;
}