14 April 2010

CSS rules for IE6 and lower

This is a neat and useful shorthand for writing CSS that IE 6 and lower will use; higher versions of IE and other browsers will ignore this:
margin-top:50px;
_margin-top:20px;

Note the underscore character. The first margin-top rule is used by all browsers, including IE6; the second one is used only by IE6 (and lower), overriding the first. I think you can use this same trick for all CSS rules.

No comments: