You might want to study this article here , which explains how to use conditional comments to set classes in an html element. You can then use this class to target specific browsers in your stylesheet in its purest form.
Your html tag will look something like this:
<html class="">
Edit 2
Because the announcement that IE10 does not support conditional comments, although it would be nice to update this answer. I tested the type of comments that it will support, and it seems that the above will still work, but if you want to target more than 10 or only 10, you will be out of luck . As suggested by Microsoft themselves on their blog (link in @MarcoDemaio's comments), you should use feature detection.
Then you can do something like this in your css:
.somestyle { background: transparent url('derp.jpg') no-repeat; } .ie6 .somestyle { background: #eee; }
Read the article and good luck;)
Edit 2
Since IE7 is no longer my main concern, and IE9 is pretty consistent in its behavior, I can get away from just the following code (which will add a class only for versions of IE less than IE9):
<html lang="en">
Change 1
Ok, I was able to skip the comment "cant" edit html.
In this case, you can only use browser hacks, I think they are dirty, but hey, if you have no other choice ...
Something like that:
.someclass { *color: blue; _color: blue; } .someclass { *color: blue; } .someclass { color: blue\0/; }
source share