Cascade is the cascade of style sheets. Is the process of adding a style layer by layer in the style sheet. Let the browser determine which value to use for multiple sources of specific attribute values of a tag. Cascade is the core mechanism of CSS.
Document Style source?
①: The default style of the browser. Each browser has a set of default styles.
②: User style, which is important to users with Visual Impairment
③: Author style. That is, the style designed by Web developers.
The order of different styles stacked by the browser:
The browser will check the source of each style in sequence according to the above Order, and update the settings of related labels. After the whole check is updated, each label will be displayed with the final set style.
The following are specific cascade rules:
Rule 1: locate all declarations that are applied to each element and attribute.
When the browser loads the page, it checks Each CSS rule and marks the affected HTML Tag.
Rule 2: sort by order and weight
The browser checks five sources in sequence, and the declaration can also be passed! Increase the weight of important, for example
Here, the color value of a is always set to red. Five style sheets are ignored.
Rule 3: Calculate the specified degree for sorting
How to calculate the specialization?
To be updated later ......