CSS hack (CSS multi-browser compatibility)

Source: Internet
Author: User
Int I = 0; Int J = 1;

In web development, everyone will encounter CSS compatibility with different browsers. Although it is not a big problem, it is really frustrating, especially for some inexperienced developers, it is a special headache. I often see people complaining about too many browser versions on the Internet, but there is always competition in the market. If there is a problem, we can solve it. The following is my summary of CSS hack for different browsers, hoping to help those who need it.

 

Background: blue; Firefox background turns blue
Background: red/9; The IE8 background turns red
* Background: black; IE7 black
_ Background: orange; The IE6 background changes to orange

 

Less than IE6

* HTML {}

Less than IE 7

*: First-Child + HTML {} * HTML {}

Only for IE 7

*: First-Child + HTML {}

Only for IE 7 and modern browsers

HTML> body {}

Only for IE 8 (the attribute value is appended with/0)

. Name {color: # CCC/0 ;}

Only for modern browsers (not IE 7)

HTML>/**/body {}

Latest versions of opera 9 or earlier

HTML: First-child {}

Safari

HTML [xmlns * = ""] body: Last-child {}

Firefox 3

. Classname, X:-moz-any-link, X: Default {}

# ID, X:-moz-any-link, X: Default {}

 

================================

Background grayed out in all browsers (translucent)

Body {filter: alpha (opacity = 30); opacity: 0.3; Background-color: # CCC ;}

================================

Difference between IE6 and FF:

Background: orange; * Background: blue;

Difference between IE6 and IE7:

Background: Green! Important; Background: blue;

Difference between IE7 and FF:

Background: orange; * Background: green;

Difference ff, IE7, IE6:

Background: orange; * Background: Green! Important; * Background: blue;

Difference ff 3

Add ", X:-moz-any-link, X: Default" before "{", and only FF 3 can recognize it.

 

Note:

Ie can recognize *; standard browsers (such as ff) cannot recognize *;

IE6 can recognize *, but cannot recognize it! Important,

IE7 can recognize * and can also recognize! Important;

Only IE8 can recognize/0

FF cannot recognize *, but can recognize it! Important;

 

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.