Targeted CSS – IE 6 or IE 7 down

There is a pretty well known hack for CSS that allow us to target Internet Explorer 6 and older. This is a life saver because IE has never handled the box model correctly. Padding is especially problematic in older versions.

Underscore hack to the rescue! Here’s how you might use it…

.myClass {
position:absolute;
left:15px; /* all standards compliant browsers */
_left:35px; /* IE 6 and older */
}

Ok, great. But what if you need to target IE 7 and below? Star hack to the rescue! Here’s how to use it…

.myClass {
position:absolute;
left:15px; /* all standards compliant browsers */
_left:35px; /* IE 6 and older */
*left:45px; /* IE 7 and older */
}

This has been such a life saver to me I thought I would post it in at least one more place on the web. Get with it Microsoft IE team! Quit trying to force everyone else to use your busted rendering model and get standards compliant!

Read previous post:
Life Design Tip – Backup your stuff

Recovering data from a failed hard drive There's not much worse than realizing that you just lost months and months...

Close