开发者

CSS Differences Between IE and FF

I hope I'm not breaking any rules by asking a question that pertains to a project I'm working on. If you view my page here and view it in Firefox and again in Internet E开发者_JAVA百科xplorer, the width of the main content boxes differs. In Firefox, everything aligns perfectly with the advertisement at the top of the page, but in IE, the width of the content boxes seems to fall short by about 20 or so pixels.

My question is obvious by now, but what is causing the width in IE to fall short, and what would a simple solution be?

If I happen to be breaking the rules by asking a question that is not generic enough to benefit others, then allow me to rephrase it; what would be the best approach to solving visual differences between browsers? Should I use a separate CSS file for IE, or is there a way to define lines in my CSS file that only get rendered by a specific browser?

It would be best if someone could provide me with the necessary CSS to align things properly, but I would be more than happy to learn about how to make the CSS dynamic (if that's possible).

Thanks everyone. :)


Your HTML is not well formed. You need <html>, and <title> should be in <head>. Most importantly, you need a DOCTYPE so that browsers will use standards mode instead of quirks mode when rendering. Quirks mode is the cause of the differing widths.

The HTML 5 doctype is: <!DOCTYPE html> and should be the first line of your HTML file. Below is a minimum HTML file.

<!DOCTYPE html>
<html>
    <head>
        <title>Document</title>
    </head>
    <body>
    </body>
</html>


try using

box {
    width: 100%;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜