. color{ Background-color: #CC00FF; Background-color: #FF00009; *background-color: #0066FF; _background-color: #009933; }
* * Remember that the above style is interpreted as the order is FF, IE8, IE7, IE6 * * Display results: Browse with Firefox, color is purple with IE8 browse, color is red with IE7 browse, color is blue with IE6 browse, color is green
IE8 Latest CSS hack: "" Example: "margin:0px auto;". Here the "" can distinguish all IE and Firefox. "9" Example: "margin:0px auto9;". Here the "9" can distinguish all IE and Firefox. "*" IE6, IE7 can be identified. IE8, Firefox cannot. "_" IE6 can Identify "_", IE7, IE8, Firefox cannot.
Some IE6 IE7 IE8 ff CSS hack
P{+color: #f00;} support IE6 IE7 does not support FF Ie8p{_color: #f00;} support IE6 not supported Ffp{color: #00f!important;} P{color: #f00;} support IE7 IE6 ff Ie8p{color: #00f!important;color: #f00;} support IE7 IE8 FF does not support Ie6head:first-child+body P{color: #f 00;} Support IE7 IE8 FF does not support IE6
CSS hack compatibility table for each browser:
|
IE6 |
IE7 |
IE8 |
Firefox |
Chrome |
Safari |
!important |
|
Y |
|
Y |
|
|
_ |
Y |
|
|
|
|
|
* |
Y |
Y |
|
|
|
|
*+ |
|
Y |
|
|
|
|
9 |
Y |
Y |
Y |
|
|
|
|
|
|
Y |
|
|
|
Nth-of-type (1) |
|
|
|
|
Y |
Y |
Tip: What is CSS hack? Because of different browsers, such as IE6, IE7, IE8, Firefox, and so on, the parsing of CSS is not the same, so it will result in the resulting page effect is not the same, not get the page effect we need. At this time we need to write different CSS for different browsers, so that it can be compatible with different browsers, can be in different browsers can also get the desired page effect. The process of writing different CSS code for different browsers is called CSS hack, also called CSS hack.
CSS hack compatible with Ie6/ie7/ie8/firefox