Solve IE6, IE7, Firefox compatible with the simplest CSS Hack

Source: Internet
Author: User

Write three lines of code to control an attribute , different from Firefox, Ie7,ie6:

    background:orange;     *background:green! important;     *background:blue;

Note: This code causes the background to be orange in Firefox, Green in IE7, and blue in IE6.
The reason is as follows, Firefox does not recognize *, so the following two sentences are not executed, directly execute the first sentence; IE7 three can be identified, but because of the second sentence important, so the second sentence code is executed, IE6 can not identify!imprtant, according to the latest principles, Then take the last sentence for granted.


Note: Another way:

    background:orange;     *Background:green;    _background:blue;

Firefox does not support * and _, so only the first sentence; IE7 does not support _, so the implementation of the second sentence; IE6 realizes the third sentence.

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.