发新话题
打印

这个问题让我很纠结,纠结2年了

这个问题让我很纠结,纠结2年了

下面的代码中css  
.left_main{float:left;
width:610px;
height:420px;
background:red;
clear:right;
}
.right_main{

width:180px;
height:420px;
background:red;
}
.left_main中不是有clear:right了吗,也就是不让右边有浮动。

那.right_main的框架不是要在.left_main正下方了吗。可测试下来确实.right_main框架浮动到.left_main右边了,这是怎么回事呢?
这个问题纠结2年,求大师们帮忙解惑啊。

------------------------------------------------
<html>
<head>
<title>css</title>

<style>
<!--
body{margin:0px;
       text-align:center;
       background:#ffffcc;
      }

#container{
width:800px;
height:1000px;
background:yellow;
marginpx auto;
}

#header{width:800px;
        height:100px;
        background:red;
margin:0px auto;
}

#logo{float:left;
width:250px;
height:90px;
background:green;
margin:0px;
}

#banner{
width:530px;
height:90px;
margin:0px;
background:blue;
}

#menu{width:800px;
height:35px;
background:#ff00ff;
}

.nav{width:800px;
height:10px;
background:#ffffff;
line-height:10px;
}
.left_main{float:left;
width:610px;
height:420px;
background:red;
clear:right;

}
.right_main{

width:180px;
height:420px;
background:red;
}



//-->
</style>
</head>


<body>
<div id="container">
    <div id="header">
        <div id="logo">
1111111111111111111111
        </div>

        <div id="banner">
11111111111111111111111111
        </div>
     </div>

     <div id="menu">
111111111111
     </div>
     <div class="nav">
1111111111
     </div>
     
     <div class="left_main">
     </div>
<div class="right_main">
     </div>
</div>
</body>
</html>

[ 本帖最后由 wukunda 于 2012-12-5 14:16 编辑 ]
帮帮忙啊。。。。
一个既设置了clear又设置了float属性的对象,只有clear:left属性生效,clear:right不起作用。

希望对你有帮助~
发新话题