开发者

Strange margin problem in IE6

开发者 https://www.devze.com 2023-03-28 09:41 出处:网络
HTML: <div id=\"outter\"> <div id=\"left\"> <div id=\"up\"> This is the up div </div>

HTML:

<div id="outter">
    <div id="left">
        <div id="up">
            This is the up div
        </div>
        <div id="down">
            <h3>This is the down div</h3>
        </div>
    </div>
</div>   

CSS:

#outter{
    height: 400px;
    background: white;
    border: 1px solid #bfd2e1;
}
#left{
    float: left;
    margin-right: 0;
    padding: 0;
}
#up{
    width: 355px;
    height: 50px;
    border: 1px solid #ffe59f;
    padding: 12px;
    line-height: 16pt;
    margin: 15px 0 0 15px;
}
#down{
    float: left;
    margin: 15px 0 0 15px;
    width: 381px;
}
#down h3{
    border: 1px solid #bfd2e1;
    background-color: #edf6fe;
    padding: 10px;
}

The pr开发者_开发技巧oblem is, in Chrome/Firefox, the page looks like:

Strange margin problem in IE6

but in IE6:

Strange margin problem in IE6

As you can see, there is a margin problem with #down.

Fiddle: http://jsfiddle.net/wong2/dTEcs/1/

How could that happen?


IE6 doubles margins on floated elements.

Add display: inline to your floated element (#down).

0

精彩评论

暂无评论...
验证码 换一张
取 消