Thursday, June 5, 2008

Targetting IE7 with CSS

I've needed to target IE6 & IE7 within my css for 1 margin rule, so rather than some convoluted process I used the following simple hack

margin: 10px 10px 5px 10px;
*margin: 10px 10px 10px 10px; /* Targets IE6 & IE7 */
_margin: 5px 5px 5px 5px; /* Targets IE6 */

Yes it is invalid CSS, but I don't really care, it's 1 - 2 lines in a 200 line stylesheet.

No comments: