ie6下padding bug
时间:2011-05-01 来源:肥杜
今晚发现ie6下原来还有一个bug,看代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<style type="text/css">
*{ margin:0; padding:0;}
#layout{ padding-top:10px;}
#layout .test1,#layout .test2{ border:1px solid #ccc;}
#layout .test1{ float:left;}
#layout .test2{ clear:both;}
</style>
</head>
<body>
<div id="layout">
<div class="test1">test1</div>
<div class="test2">test2</div>
</div>
</body>
</html>
这样,在IE6下,浮动层后的层也有padding-top,谷歌了下,说是什么3像素引起的,我原来自己的解决方案是在test2这个div里加个margin-top:-10px;这样解决,但发现可以通过给#layout这div一个zoom:1激活haslayout,从而解决问题。标记以记之。 相关阅读 更多 +
排行榜 更多 +










