IE6, IE7, IE8, firefox compatibility css hack code + example

Source: Internet
Author: User

IE6, IE7, IE8, firefox compatibility css hack code + example

Organize questions about IE6, IE7, IE8, firefox compatibility css hack

1. Distinguish between IE and non-IE browser CSS hack code
#divcss5 {
Background:blue; /* Non IE background blue */(Music massage chair)
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.). (Music massage chair)

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 * * (Music massage chair)
}

"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. (Music massage chair)

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.