Tuesday 12 January 2010

CSS trick for IE

I've just learned a very simple CSS trick that allows you assigning different attribute values if the page is rendered by IE. All you need to do is use '#' and '_' prefixes:

.myTestClass{
width: 5px; /* value used by all other browsers */
#width: 7px; /* value used by IE */
_width: 9px; /* value used by IE6 and older */
}


I don't think it's a part of the CSS official specification but it works ;)