注册 登录
编程论坛 ASP.NET技术论坛

关于css div浮动的问题

liangwenbc 发布于 2012-05-31 21:02, 579 次点击
<head runat="server">
    <title></title>
    <style type="text/css">
      #all{width:600px;height:100px;}
      #u1{width:300px;height:100px;float:left}  
      #u2{width:300px;height:100px;}
    </style>
</head>
<body>
    <div id="all">
    <div id="u1"></div>
    <div id="u2"></div>
    </div>
</body>
</html>
-------------------------------------------------------------------------------------
<head runat="server">
    <title></title>
    <style type="text/css">
      #all{width:600px;height:100px;}
      #u1{width:300px;height:100px;}  
      #u2{width:300px;height:100px;float:right}
    </style>
</head>
<body>
    <div id="all">
    <div id="u1"></div>
    <div id="u2"></div>
    </div>
</body>
</html>
不明白红色部分代码的区别,第二段代码u2为何会跑到下面?
2 回复
#2
liangwenbc2012-06-03 23:59
哎。。冷清得不行,关了
#3
scmxiaoming2012-06-06 18:46
因为你 #ALL没有给他定位
1