The CSS important stuff.

Source: Internet
Author: User

CSS!important function is to improve the application priority of the specified CSS style rules

!important is the syntax defined by CSS1, which is to increase the application priority of the specified style rule. The syntax format {cssrule!important}, which is written on the last face of the definition, for example: Box{color:red!important;} In CSS, by declaring to a certain style! Important, you can change the default CSS style precedence rule so that the bar Style property declaration has the highest priority, which is equivalent to writing at the bottom. Promotes application precedence for a specified style rule.
    • IE6 and the following browsers have a more explicit support problem exists,!important does not overwrite the rules that fall behind the same style. Take a look at the following code:

      Example code:

      div{color:#f00!important;color:#000;}

      In the above code, IE6 and the following browser div text color is #000,!important does not overwrite the following rules; Other browsers the text color of the DIV is #f00

IE6 and the following browsers for the!important to take effect, the following code is available:

Example code:

div{color:#f00!important;}div{color:#000;}

In the above code, IE6 and the following browsers in the text color of the div is consistent with other browsers, are #f00

Role: Write Browser compatibility

CSS hack because of different vendors ' browsers, such as the Internet Explorer,safari,mozilla Firefox,chrome, or different versions of the same vendor's browser, such as IE6 and IE7, The parsing of CSS is not exactly the same, so the resulting page effect is not the same, and the page effect we need is not. At this time we need to write different CSS for different browsers, so that it can be compatible with different browsers, can be in different browsers can also get the desired page effect.

The CSS important stuff.

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.