Introduction to Browser-Specific CSS Hacks

I’ve put several tricks together to make this easier:

http://www.queerminds.com/realitystorm/memory/internet/css/browser_specific_style_sheets.cfm

<link href=“/_interface/basic_css1.css” rel=“stylesheet” type=“text/css” />
<!–[if IE]><![if gte IE 7]><![endif]–><style type=“text/css”>/\/ @import url(“/realitystorm/_interface/themes/angels_and_insects/standard.css”) all; //</style><!–[if IE]><![endif]><![endif]–>
<!–[if lt IE 7]><link href=“/realitystorm/_interface/themes/angels_and_insects/win_ie.css” rel=“stylesheet” type=“text/css” /><![endif]–>
<!–[if gte IE 5.5]><link href=“/realitystorm/_interface/themes/angels_and_insects/win_ie_filters.css” rel=“stylesheet” type=“text/css” /><![endif]–>
<!–[if gte IE 5.5]><script src=“/_interface/_javascripts/imageobjectpng.js” type=“text/javascript” defer></script><![endif]–>
<style type=“text/css”>/\//*/ @import url(“/realitystorm/_interface/themes/angels_and_insects/mac_ie.css”); /
/ </style>
<script type=“text/javascript”>if(document.layers) {document.write(unescape(‘%3CLINK%20href%3D%22/realitystorm/_interface/netscape4x.css%22%20rel%3D%22stylesheet%22%20type%3D%22text/css%22%20/%3E’));}</script>

Instead of using iCapture or Browsercam, you can get PearPC (www.pearpc.net / pearpc.soundforge.net) and run Mac OS X on your PC. I have Safari 1.2.4 running quite happily on my PC, which is very handy for testing out web applications with heaps of javascript and xml requests going on…

You’ll still need to buy a copy of OS X, though they’re quite cheap on eBay. Don’t get any version earlier than 10.3 Panther, otherwise networking won’t work.

Thanks so much for this article and all the other tips…I designed my site through IE, so now I am working backwards. This has been so helpful.

I’m so glad I found this article. I wish IE had a web developer toolbar which was as cool as the Firefox one so you can edit the CSS and see the changes apply immediately!

Well, that’s how I used to think! After reading your article I’ve learnt that hacks aren’t hard after all :).

very good article :wink:

right , you dont want to redo the page for your client for free for no of times that new browsers and versions emerge!

This is great article gives u the a better idea how css hack would work on and how to use the right in places

#header {margin-bottom:3em}
html>body #header {margin-bottom:1em}

it actually worked! AMAZING :smiley: tnx a million :smiley:

html>body #header {margin-bottom:1em}

will be understood by IE 7, coming out next year!! you have been warned!

May I suggest using IE conditional comments too?

http://www.quirksmode.org/css/condcom.html

Regards!

Hi. You have very nice website! Beautiful design.

html>body #header {margin-bottom:1em}

so far, IE7 beta release has not picked up on it.

html>body #header {margin-bottom:1em}
so far, IE7 beta release has not picked up on it.

IE7 beta2 does support the child selector. (CSS 2.1 Selector support (child, adjacent, attribute, first-child etc.))

Nice post. Very useful and helpful information on CSS. Its very difficult to work the CSS on IE 6 or other IE versions.

What about when Firefox doesn’t do what the CSS tells it to do?

What about when Firefox doesn’t do what the CSS tells it to do?

An example please!

to hide css from IE7 you can use:
html>/**/body .someClass {
}

cheers, Yoav Aharoni. That helped me overload a css statement that both FF & IE was recognizing. much thx

Excellent article! Thank you :slight_smile:

Yoav - that hack appears to hide CSS from IE, period. Got anything that hides CSS from IE7 but allows IE6 to see it?