在远方_所谓日志

换成了黑色并不是为了显酷,据说浏览黑颜色的网页可以省电!

« #include file 和 #include virtual的区别gb2312和utf-8两种编码下的UrlEncode()分析 »

IE6下靠边浮动的元素的margin加倍的问题

找了半天不知道到底啥问题,原来是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>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog

Copyright 2006-2008 luwei.net.cn. Some Rights Reserved.

苏ICP备07023786号