IE6, 7,8, ff css hack

Source: Internet
Author: User

CSS compatibility has always been a headache for everyone. Now let's talk about how to differentiate these browsers. IE6, IE7, IE8, and FF all refer to the official IE8 version. Version: 8.0.6001.18702.

Taking color as an example, how to distinguish these browsers:

. Csshack {
Color: # f00;/* display the CSS-supported browsers in red */
Color: # 00f \ 9;/* IE8 can be identified to overwrite the preceding rule in blue */
* Color: #0f0! Important;/* IE7 can identify and overwrite the above rules to be displayed as green */
* Color: #000;/* _ color: #000; * // * IE6 can be identified and overwrite the above rules to be black */
}

Here, "\ 9" can distinguish all IE and Firefox.
"*" IE6 and IE7 can be identified. IE8 and Firefox cannot.
"_" IE6 can recognize "_". IE7, IE8, and Firefox cannot.
Both IE7 and IE8 can be recognized! Important.
In this way, you can completely separate IE6, IE7, IE8, and Firefox.

But pay attention to the order of writing: the browser should write at the beginning, the IE6 should write at the end for overwrite, and other browsers should write in the middle.

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;

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
FF cannot recognize *, but can recognize it! Important

IE6 supports underlines, while IE7 and Firefox do not.

So you can also distinguish IE6, IE7, and Firefox.
: Background: orange; * Background: green; _ Background: blue;

* Html p {color: # f00;} supports IE6 and does not support FF IE7 ie8b.

* + Html p {color: # f00;} supports IE7 ie8b and does not support FF IE6

P {* color: # f00;} supports IE7 IE6 and does not support FF IE8

Note: No matter what method, the order of writing is Firefox's preface, IE7's writing in the middle, and IE6's writing in the back

From hair http://www.yihuan.cc/trackback.asp? Tbid = 53 & Action = addtb & tbkey = 4b60f519832124e44d22e421ff4ba3ba720af645

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.