Some hack issues with browsers

Source: Internet
Author: User

Common CSS hack four kinds of symbols test results:
——---——— ie6-ie7-ie8-ff--opera9.5
>property--y--y--y--n--n
. property--y--y--y--n--n
*property--y--y--n--n--n
_property--y--n--n--n--n

IE6 Dedicated _ Ie6-7 * ie6-8. !important except IE6 not recognized, Firefox priority recognition

Firefox browser-specific:

@-moz-document Url-prefix () {selector {property: value;}}

1. Differentiate between IE and non-IE browsers CSS Hack Code

#div {background:blue;background:red \9;}

2. Distinguish ie6,ie7,ie8,ff CSS HACK
"Distinguishing symbols": "\9", "*", "_"
"Example":

#div {background:blue;background:red \9;*background:black;_background: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":

#div {background:blue;*background:black;_background: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":

#div {Background:blue;*background:green!important;*background: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":

#div {Background:blue;*background:green!important;}

"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":

#{*background:black;_background: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":

#div {background:black!important;background: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":

#div {background:black;_background: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.

Some hack issues with browsers

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.