在IE6.0下出現浮動邊距加倍解決辦法

使用Dreamweaver的【目標瀏覽器檢查】功能會提示浮動邊距加倍: 
如果某條邊與浮動方向同向,則向該邊上的浮動框應用邊距時,邊距會增加一倍。此錯誤隻影響一次或多次浮動的某行中的第一次浮動。    
影響: Internet Explorer 6.0 目前所知該錯誤隻影響ie6而不影響其他瀏覽器。 
解決方法:添加display:inline;
例子:
當box爲float時,IE6中box左右的margin會加倍。
 
     
<!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=gb2312" />
<title>[url]www.52css.com[/url]</title>
<style>
.outer {
width:450px;
height:150px;
background:#fc0;
}
.inner {
float:left;
width:200px;
height:100px;
margin:5px;
background:#fff;
}
</style>
</head>
<body>
<div class="outer">
<div class="inner"></div>
<div class="inner"></div>
</div>
</body>
</html>
 
         左面的inner的左面margin明顯大於5px。這時候,定義inner的display屬性爲inline。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章