开发者

Why margin and padding work properly in Opera but not in IE 8 and FF 3.6?

HTML Code:

    <!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>
    <title>CSS Test Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    body
    {
        margin: 0;
        padding: 0;
    }
    #int
    {
        width: 1000px;
        text-align: justify;
        border: solid 1px #000;
    }
    </style>    
        </head>
<body>

<div id="int">
Some simple text...
</div>

</body>
</html>

And the results: Opera 11

Why margin and padding work properly in Opera but not in IE 8 and FF 3.6?

Here it works!

But... Internet Explorer 8

Why margin and padding work properly in Opera but not in IE 8 and FF 3.6?

...and Firefox 3.6

Why margin and padding work properly in Opera but not in IE 8 and FF 3.6?

The problem is only if this code using as layout for Yii Web App... Where I am w开发者_JS百科rong? Help, please.

P.S. kennel.cms.ua - this site is running on local web-server :)


I would, if I was you, do things properly if you really want to have cross browser support.

ADD a CSS Reset prior to play around with CSS!

There are a bunch of them, just use it.

If you want to know what's the best CSS Reset I would encourage you to read this question


Are you complaining because of the margin-top that exists in FF and IE, but in Opera?

try to set these attributes in the CSS.

display: inline;
float: left;
height: auto;
position: relative;
text-align: left;
width: 100%;

I think it will solve your problem :D

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜