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