Inline CSS conditional comments

.whatever {
color: red; //all browsers well display red text
*color: green; //IE 7 will display green text
_color: blue; //IE 6 will display blue text
}

But how do I write inline css conditional statements to isolate IE8 or even all IE browsers.

Thanks.
Karl.

Check out David Blooms inline IE8/7 hack.

Even if it targets 8 & 7, you could do the stack like this so it targets the ie8/7 hack and then the 7 hack:


.whatever{
  color:red;               /* normal, all browsers */
  color /*\\**/: orange\\9   /* ie8 & 7 hack */
 *color: green;            /* target ie7 next */
 _color: blue;             /* target ie6 last */
}

Oh, and apparently, this will get you all IE versions, even IE8 in standards mode:


.test { color: blue\\9; }  /* target all IE browsers */

Be sure to check the comments on that site, people have found some other ways, too. I haven’t tested many of them to see how they work, though.

Oops, definitely check out the comments, there is some great stuff there about that hack as well as hacks targeting other browsers.

Thanks Hornet…appreciated. I have searched high and low for that. :slight_smile:
Checking-out the link now.

Regards, Karl.