今天工作中发现一个问题,看算不算BUG,如何解释这种现象。


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>bug</title>
<style>
ul,li{margin:0;padding:0;list-style:none;}
.fl{float:left;display:inline;}
.imgList{width:200px;background:red;}
.imgList li{height:20px;border:1px solid green;}
</style>
</head>
<body>
<ul class="imgList fl">
<li>IE6 IE7与UL产生的间距</li>
</ul>
</body>
</html>

注意IE6 IE7下的效果与其它浏览器效果不一致。
由于项目需求,必须用到float:left;display:inline;问题来了,如果把这个class给如上代码UL,IE6 IE7 LI前就出现莫名间距。换成其它标签不会出现此现象。
比如换成:dl dd

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>bug</title>
<style>
dl,dd{margin:0;padding:0;list-style:none;}
.fl{float:left;display:inline;}
.imgList{width:200px;background:red;}
.imgList dd{height:20px;border:1px solid green;}
</style>
</head>
<body>
<dl class="imgList fl">
<dd>换标签了一切正常了</dd>
</dl>
</body>
</html>

针对代码ul li现象尝试了如下解决办法:
1、给li也float:left;
2、去掉UL的display:inline;

由于IE6有符动间距BUG所以.fl{float:left;display:inline;}习惯性的写在一起。让我等不得其解的是为何只跟UL LI有关呢?这算是一个BUG么?求点解!所以然!!

原来是它在捣鬼:list-style-position:outside;呵呵!完必!

posted @ 2011-08-24 19:57  radom  阅读(282)  评论(0编辑  收藏  举报