CSS hack:ie6, IE7, IE8, Firefox compatibility problem resolution

Source: Internet
Author: User
Tags browser change difference example firefox hack ie browser ie browsers

1. Distinguish IE and non ie browsers
#tip {
Background:blue; * * Non IE background blue/
Background:red 9; /*ie6, IE7, IE8 background Red * *
}

2. Difference Ie6,ie7,ie8,ff
"Difference symbol": "9", "*", "_"
Sample:
#tip {
Background:blue; /*firefox Background to Blue * *
Background:red 9; /*IE8 Background Red * *
*background:black; /*IE7 Background Change Black * *
_backgroundrange; /*IE6 Background Change Orange * *
}
"description": Because the IE series browser can read "9", and IE6 and IE7 readable "*" (m), IE6 can be recognized "_" (bottom line), so you can write down in order, it will allow the browser to read the correct view of their own CSS syntax, So you can effectively differentiate IE versions and non ie browsers (like Firefox, Opera, Google Chrome, Safari, etc.).

3. Distinguish IE6, IE7, Firefox (Method 1)
"Difference symbol": "*", "_"
Sample:
#tip {
Background:blue; /*firefox Background to Blue * *
*background:black; /*IE7 Background Change Black * *
_backgroundrange; /*IE6 Background Change Orange * *
}
"description": IE7 and IE6 readable "*" (m), IE6 can read "_" (bottom line), but IE7 can't read "_", as for Firefox (non IE browser) is completely unable to identify "*" and "_", so you can distinguish between IE6, IE7, Firefox

4. Distinguish IE6, IE7, Firefox (Method 2)
"Difference symbol": "*", "!important"
Sample:
#tip {
Background:blue; /*firefox Background to Blue * *
*background:green!important; /*IE7 Background Change Green * *
*backgroundrange; /*IE6 Background Change Orange * *
}
"description": IE7 can identify "*" and "!important", but IE6 can only identify "*", but cannot identify "!important", as Firefox can read "!important" but cannot identify "*" So the difference can be used to effectively partition IE6, IE7, Firefox.

5. Distinguish IE7, Firefox
"Difference symbol": "*", "!important"
Sample:
#tip {
Background:blue; /*firefox Background to Blue * *
*background:green!important; /*IE7 Background Change Green * *
}
"description": Because Firefox can identify "!important" but can't identify "*", while IE7 can read "*", "!important", so you can distinguish between two identification symbols IE7 and Firefox.

6. Distinguish IE6, IE7 (Method 1)
"Difference symbol": "*", "_"
Sample:
#tip {
*background:black; /*IE7 Background Change Black * *
_backgroundrange; /*IE6 Background Change Orange * *
}
"description": IE7 and IE6 can identify "*" (m), but IE6 can identify "_" (bottom line), IE7 is not recognized, through the IE7 can not read the characteristics of "_" to relax the difference between IE6 and IE7.

7. Distinguish IE6, IE7 (Method 2)
"Difference symbol": "!important"
Sample:
#tip {
Background:black!important; /*IE7 Background Change Black * *
Backgroundrange; /*IE6 Background Change Orange * *
}
Description: Because IE7 can read "!important;" But IE6 is not, and the CSS reading step is from top to bottom, so IE6 read when the inability to identify the "!important" and skip directly to the next line to read CSS, so the background color will be orange.

8. Distinguish IE6, Firefox
"Difference symbol": "_"
Sample:
#tip {
Background:black; /*firefox Background Change Black * *
_backgroundrange; /*IE6 Background Change Orange * *
}
"description": Because IE6 can identify "_" (bottom line), but Firefox is not, so you can through the difference between Firefox and IE6, effectively achieve CSS hack.

Related Article

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.