CSS _ cascade Mechanism

Source: Internet
Author: User

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 ......

 

 

 

 

 

 

 

 

 

 

Related Article

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.