IE6双倍边距就是指当元素有float属性,又有margin属性时,在IE6下面显示的margin的值是设置值的两倍。下面的代码:
<div style="width:200px;height:50px;background:#ccc;">
<div style="width:100px; height:50px;float:left;margin-left:10px; background:#eee;"></div>
</div>
当在ie6和其他浏览器中调试时,可以看得出来左边距在IE6下面明显比IE8下面的大,在ie6下面的左边距(margin-left:)变成了20px,而不是设置的10px。
IE6双倍边距的解决办法:将有float属性的元素添加display:inline属性。(根据具体情况看加哪个浮动元素上合适)
<div style="width:200px;height:50px;background:#ccc;">
<div style="width:100px; height:50px;float:left;margin-left:10px; background:#eee; display:inline"></div>
</div>
现在在浏览器中调试看效果,在各种浏览器中测试margin-left都显示为正常的10px;