IT码农库

您当前所在位置:首页 > 网络编程 > CSS/HTML

CSS/HTML

IE Bug--浮动对象外补丁的双倍距离的解决方法

网络 2007-01-29CSS/HTML4993
The IE Doubled Float-Margin Bug  IEBug--浮动对象外补丁的双倍距离 先看以下代码: #box{     background: ThreedFace;     width: 500px;     height: 400px;  &n...
The IE Doubled Float-Margin Bug  IEBug--浮动对象外补丁的双倍距离

先看以下代码:

#box{
    background: ThreedFace;
    width: 500px;
    height: 400px;    
}

#box1{
    float: left;
    background: #F2F2F2;
    width: 300px;
    height: 200px;
    margin-left: 50px;    
}

Box在外面,Box1在里面,但在IE浏览器中Box1离左边的距离会是100px,而实际距离应是50px,演示。

解决的方法是,在box1的代码中加入:display: inline;,可使浮动被忽略,IE中不至于产生双倍距离,演示,更详细资料,可看这里 。
大图广告(830*140)