Browser CSS Differences (IE6 IE7 Firefox)

Read Time:54 Second

Typically the 3 major browsers used are Firefox, IE6 and IE7. Perhaps you thought they would behave the behave the same when rendering CSS in the browser window? If only life were that simple.

(This article is from http://neilkilbride.blogspot.com/2008/01/browser-css-differences-ie6-ie7-firefox.html)

Although Firefox and IE7 and more similar than ever in rendering CSS, IE6 has always had a mind of its own, adding padding and spacing amongst other things in random locations. However, there is a simple way to cater specifically for the major browsers. IE6recognises underscore lines, but IE7 does not. IE6 and IE7recognise period lines. For example…

[code]

#header
{
margin-top: 8px;
.margin-top: 10px;
_margin-top: 4px;
}

[/code]

 

Firefox, and every other non-IE browser, will only see and use the8px, IE6 will see the 10px line, but then the 4px line will stomp on it, and only IE7 will see the 10px line. You can now support all major browsers without having to write a serverside script, clientside script or even a horrible CSS expression :)

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.