找了半天不知道到底啥问题,原来是ie6的bug,靠
-------- 问题描述 ------------------------------------------------------------------
最左边的一个float:left;明明是margin-left:5px;却多出来了5px
-------- 解决答案 ------------------------------------------------------------------
这是ie6中一个十分经典的Bug,即:靠边浮动的元素的margin加倍。这时只要将此元素(背景色为红色的元素)的display属性改为inline。修改后的代码: <html> <div style="float:left;margin-left:10px;background:red;width:20px;height:20px;display:inline;"></div> <div style="float:left;background:green;width:20px;height:20px;"></div> <div style="float:left;background:blue;width:20px;height:20px;"></div> <div style="clear:left;margin-left:10px;background:black;width:20px;height:20px;"></div> </html>