Css hack of IE9

web front end ten thousand nine hundred and twenty-one 13 years ago (2011-09-30)

div {

background-color:red\0;   /* ie 8/9*/

background-color:blue\9\0;   /* ie 9*/

*background-color:green;   /* ie 7*/

_background-color:gray;   /* ie 6*/

}

Note the order of writing csshack, where:

1.background-color:red\0; IE8 and IE9 All support;
2.background-color:blue\9\0; Only IE9 supports;

(1) Distinguish FF (IE8) from IE6 IE7

backgorund:orange; FF and IE8 background color will be orange

*backgorund:red; IE6 and IE7 background color will be red

(2) Distinguish FF (IE8) from IE6 and IE7

background:orange; FF and IE8 background color will be orange

*background:red ! important; IE7 background color will be red

*background:blue; IE6 background color will be blue

(3) Distinguish FF (IE8) from IE6 and IE7

background:orange; FF and IE8 background color will be orange

*background:red; IE7 background color will be red

_background:blue; IE6 background color will be blue

(4) Distinguish FF from IE6 IE7 IE8 IE9

color:gray; FF and other non IE browser typeface Color will be gray

color:red\9; IE8 IE9 font color will be red

*color:green; IE7 font color will be green

_color:blue; IE6 font color will be blue

Tip: CSS HACK writing order: write FF and other non IE browser required styles first, then IE8/9 required styles, then IE7, then IE6!

Conclusion: I feel it is seldom used in practice! Important, as long as you remember "*" and "_", I think it is enough to distinguish from FF (IE8) and IE6 and IE7