Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Feed different CSS rules to IE5.0, 5.5 and 6.0 (See related posts)

Sometimes you just have to resort to the hacks; this bit of code will let you feed three separate values for the same property to each of the three common flavors of IE on Windows:

* html whatevertherestofyourselectorwouldbe {
property/**/: value;
property: /**/ value;
p\roperty: value;
}


The first value will be applied by IE5.5, the second by IE5.0 and the third by IE6.0. The order is important; mix them up and it won't work. The "* html" on the selector ensures that only IE on Windows will see any of the values (since it mistakenly thinks there's a higher root element above html).

This was constructed from the table of CSS hacks at dithered.

Comments on this post

Reid posts on May 28, 2005 at 14:27
And if you want to then pass specific values to Mac/IE (because it has its own oddities separate from Windows/IE), add this at the end of the above:
/* for IE5/Mac */
*>html .selector {
prop\erty: value
} 

You need to create an account or log in to post comments to this site.


Related Posts