Css! Summary of important usage, cssimportant

Source: Internet
Author: User

Css! Summary of important usage, cssimportant

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

 


What should I do when I want to increase the class priority? In CSS! The role of important

* It can be recognized by Ie browsers, but not by firefox ;! Important can only be recognized by Ie7.0 and firefox, but Ie6.0 cannot be applied successfully. (1) differences between ie and firefox: border: 2px solid # f00; * border: 1px solid # f00; (2) differences between Ie6.0, Ie7.0, and firefox: border: 1px solid # f00! Important; border: 2px solid # f00; in (1), * is placed after it because ff is not recognized *, so it is set only once; after two border settings are performed in the ie series, the last attribute overwrites the previous one, so it is a pixel border. In (2), the reason why! Important is set in the first border because it increases the priority of this border. Even if it is set at one or even N times later, Ie6.0 does not accept this rule, as a result, it applies the second border setting, that is, it overwrites this principle for the first time, not it does not recognize it! Important; so its border is a 2 pixel red box. this is a simple application:
In css # different from the usage

The id is used for unique pages with the same style. If the style is not unique, the class is used. The id can only be referenced once. The class can be referenced once or more. js positioning uses the id, which is so simple ..
Id can be defined once on the page
The class can be one or more times
That is to say, if it is defined once, id and class can be used as you like ..
Use id #. It is not standard and cannot be parsed.
Class.

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.