Chapter III Structure and CASCADE
1. When determining which values should be applied to an element, the user agent not only takes into account the inheritance, but also considers the specificity of the declaration, and also the origin of the declaration itself, which is called Cascading. 、
2, Particularity. If an element has two or more conflicting attribute declarations, the Highest-specificity declaration wins.
For the value of the attribute of each ID given in the selector, add 0,1,0,0;
Generic type, attribute selection or pseudo-class, plus 0,0,1,0; (the attribute selector for the specified ID attribute still contributes 0010)
For elements and pseudo-elements, add 0,0,0,1;
The binding character and the wildcard selector do not contribute to the Particularity. (the Wildcard has no contribution to the particularity and at all no particulars have differences.) )
Inline style particularity 1,0,0,0
Note that 0,0,1,0 is more special than 0,0,0,13.
3,! Important important statements are grouped together, and conflicts are resolved within important statements. In conflict with Non-important statements, important statements always win.
Cond
CSS-CSS Authoritative Guide Study notes 3