Target Browser Versions in CSS
I recently ran across a scenario in which IE6 and IE7 were rendering CSS differently, which affected the HTML output of one of my web sites. Not good! What I discovered as a way around this is that there are built-in browser hacks that you can take advantage of in a CSS file to target specific browser types. Basically, the operators * and _ (asterisk and underscore) can be used preceding a style element in CSS to target browsers. Here's an example:
.box {
background: #00f; /* all browsers including Mac IE */
*background: #f00; /* IE 7 and below */
_background: #f60; /* IE 6 and below */
}



Comments