CSS hack for Internet Explorer

As Web Developer, I don’t like to deal with CSS for IE but all about Microsoft rigid policy to make internet explorer. I have three options to handle CSS for IE

1. IE conditional Comments

Most common way to to fix IE bug for using conditional CSS.





#2 CSS Rules Specific to Explorer (IE CSS hacks)

These is neither valid CSS hack not recommended but most of people use as second option to handle IE bugs.

* IE8 or below: to write CSS rules specifically to IE8 or below, add a backslash and 9 (\9) at the end before the semicolon.
* IE7 or below: add an asterisk (*) before the CSS property.
* IE6: add an underscore (_) before the property.

.box {
background: gray; /* standard */
background: pink\9; /* IE 8 and below */
*background: green; /* IE 7 and below */
_background: blue; /* IE 6 */
}

#3 Conditional HTML Class

I have found third option from Paul Irish , where having conditional comments for targeting specific browsers with different classes.As simply IE class taget as Parent selector.





 
This entry was posted in CSS2. Bookmark the permalink.