1. Distinguish between IE and non-IE browser CSS hack code
#divcss5 { Background:blue; /* Non IE background blue */ Background:red \9; /*ie6, IE7, IE8 background red */ } |
2. Distinguish ie6,ie7,ie8,ff CSS HACK
"Distinguishing symbols": "\9", "*", "_"
"Example":
#divcss5 { Background:blue; /*firefox background turns blue */ Background:red \9; /*IE8 Background Turn red */ *background:black; /*IE7 background turns black */ _background:orange; /*IE6 Background Turn Orange */ } |
"description": Because the IE series browser readable "\9", and IE6 and IE7 readable "*" (m font size), and IE6 can be identified "_" (bottom line), so you can write down in sequence, it will let the browser read correctly to understand the CSS syntax, So you can effectively differentiate between versions of IE and non-ie browsers (like Firefox, Opera, Google Chrome, Safari, etc.).
3. Distinguish between IE6, IE7, and Firefox (EXP 1)
"Distinguishing symbols": "*", "_"
"Example":
#divcss5 { Background:blue; /*firefox background turns blue */ *background:black; /*IE7 background turns black */ _background:orange; /*IE6 Background Turn Orange */ } |
"description": IE7 and IE6 readable "*" (m size), IE6 can read "_" (bottom line), but IE7 cannot read "_", as for Firefox (non-IE browser) is completely unable to identify "*" and "_", so you can differentiate between IE6, IE7, Firefox
4. Distinguish between IE6, IE7, and Firefox (EXP 2)
"Distinguishing symbols": "*", "!important"
"Example":
#divcss5 { Background:blue; /*firefox background turns blue */ *background:green!important; /*IE7 Background Green */ *background:orange; /*IE6 Background Turn Orange */ } |
"description": IE7 can identify "*" and "!important", but IE6 can only identify "*", but cannot recognize "!important", as for Firefox can read "!important" but not recognize "*" Therefore, this difference can be used to effectively separate IE6, IE7 and Firefox.
5. Distinguish between IE7 and Firefox
"Distinguishing symbols": "*", "!important"
"Example":
#divcss5 { Background:blue; /*firefox background turns blue */ *background:green!important; /*IE7 Background Green */ } |
"description": Because Firefox can recognize "!important" but can't recognize "*", and IE7 can understand "*", "!important" at the same time, so two identification symbols can be isolated IE7 and Firefox.
6. Difference between IE6, IE7 (EXP 1)
"Distinguishing symbols": "*", "_"
"Example":
#tip { *background:black; /*IE7 background turns black */ _background:orange; /*IE6 Background Turn Orange */ } |
"description": IE7 and IE6 can be identified "*" (m), but IE6 can identify "_" (bottom line), IE7 is not recognized, through the IE7 can not read the characteristics of "_" will be able to easily relax the difference between IE6 and IE7.
7. Difference between IE6, IE7 (EXP 2)
"Distinguishing symbols": "!important"
"Example":
#divcss5 { Background:black!important; /*IE7 background turns black */ Background:orange; /*IE6 Background Turn Orange */ } |
"description": Because IE7 can read "!important;" But IE6 but not, and the CSS reading step is from top to bottom, so IE6 read because the "!important" can not be recognized and jump directly to the next line to read the CSS, so the background color will appear orange color.
8. Distinguish between IE6 and Firefox
"Distinguishing symbols": "_"
"Example":
#divcss5 { Background:black; /*firefox background turns black */ _background:orange; /*IE6 Background Turn Orange */ } |
"description": Because IE6 can identify "_" (bottom line), but Firefox is not, so you can use this difference to separate Firefox and IE6, effectively achieve CSS hack.
The above includes the Ie6\ie8\ie7\ Firefox browser compatibility problem and solution.
If you want to reprint, please indicate the source and origin of the article URL: http://www.divcss5.com/css-hack/c286.shtml
Reproduced IE6, IE7, IE8, firefox compatibility css hack code + example--browser