第一个元素<flout>写了,想在他的旁边加一个元素.IE6会出现缝隙. 不要用margin撑开,要用flout

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="utf-8">
 5         <title></title>
 6         <style>
 7             body{
 8                 margin: 0;
 9             }
10             .box{
11                 width: 500px;
12             }
13             .left{
14                 width: 200px;
15                 height: 200px;
16                 background-color: red;
17                 float: left;
18             }
19             .right{
20                 width: 200px;
21                 height: 200px;
22                 background-color: blue;
23                 <!--margin-left:200px  不建议这么写-->
24             }
25         </style>
26         <!--
27             解决方案:
28                 1、不建议这么写
29                 2、用浮动解决
30         -->
31     </head>
32     <body>
33         <div class="box">
34             <div class="left"></div>
35             <div class="right"></div>
36         </div>
37     </body>
38 </html>

 

posted on 2016-03-02 15:42  hduhdc  阅读(194)  评论(0编辑  收藏  举报