css--Infrastructure Cascade

Source: Internet
Author: User

Weights: The weight of the wildcard * is 0, the weight of the label and pseudo-element is 1, the class selector, the weight of the property selector or pseudo-class is the weight of the 10,id selector is 100, the inline style is up to 1000. There is also a special weighted value- inheritance also has the right value but very low, some documents that it is only 0.1 of some think that there is no weight, so it can be understood that the inheritance of the lowest weight (most of the frame model properties (including margins, padding, background and borders) can not inherit. When we do the code of the Web page, some special situations need to have the highest weights for some style settings, which can be solved by using!important.

p{ColorRed;}/*Weight value is 1*/P span{Colorgreen;} /**/.warning{color:white;} /**/p span.warning{color:purple;} /**/< Span style= "color: #800000;" > #footer. Note P{color:yellow;} /**/     

When we do the code of the Web page, some special situations need to have the highest weights for some style settings, which can be solved by using!important. (!important to be written in front of the semicolon)

p{color:red!important;} p{color:Green;} / * Text will show red *      /

Equal weights: Inline style sheet (inside label) > Embedded style sheet (in current file) > external style sheet (in external file).

css--Infrastructure Cascade

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.