It’s not a very good idea to “hack” the CSS code in such a way so that certain rules will be seen by specific browsers only — usually, one or more than one version of Internet Explorer (IE Conditional Comments are a much better option, in most of the cases).

But sometimes this is the easiest (or the only) way to deal with the situation — let’s suppose, for example, that you don’t have access to the HTML but to the CSS files only. In this case, the following 4 lines of code might be useful:


body {
color: red; /* all browsers will see this */
color : green\9; /* IE8 and below */
*color : yellow; /* IE7 and below */
_color : orange; /* IE6 */
}

As you can see, it’s easy to write rules that will be “seen” only by IE8, IE7 or IE6, or a combination of these three IE versions. And let’s hope IE9 will need no hacks! ;)

(via #)

Posted in CSS

Leave a Reply

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