Multiple CSS style sheets vying for control of a particular selector

Source: Internet
Author: User
Tags format final numeric require tag name

CSS style cascading order

When more than one style sheet is used, the stylesheet needs to scramble for control over a particular selector. In these cases, there is always the rule of the style sheet to gain control over. The following attributes will determine the results of the opposite style sheet.

As mentioned before, Web page makers and readers have the ability to specify style sheets. When the rules of the two collide, the Web page maker's rules override those of the reader's other same weights. Web page makers and readers have style sheets that go beyond the browser's built-in style sheet.

Web page makers should be careful to use! Important rules, because they will go beyond the user any! Important rules. For example, a user may require a large font or a specified color due to a visual relationship, and such a user would have the possibility to declare a defined style rule for! Important, because these styles are extremely important for users to read Web pages. Any of that! Important rules go beyond general rules, so it is recommended that web makers use general rules to ensure that users with special styles need to be able to read Web pages.

Selector rules: The calculated attributes are based on their attribute level, and the style sheet can transcend the style sheet that conflicts with it, and a style with a higher feature always overrides a lower-feature style. This is just a statistical game that calculates the specified number of selectors.

Number of ID attributes in the statistics selector.

The number of class attributes in the statistics selector.

The HTML tag name format in the statistics selector.

Finally, write three numbers in the correct order, without spaces or commas, and get a three-digit number. (Note that you need to convert the number to a larger number that ends with three digits.) The final list of numbers corresponding to the selector can easily determine that a higher numeric attribute overrides a lower number. The following is a list of selectors sorted by attribute: #id1 {XXX}/* a=1 b=0 c=0--> feature =/ul ul li.red {XXX}/* a=0 b=1 features = c=3-->-013 {XXX}/* a=0 b=1 c=1--> attribute = 011/LI {XXX}/* a=0 b=0 the c=1--> feature = 001 The Order of the features for ease of use, when two rules have the same weight, take the one behind.

When more than one style sheet is used, the stylesheet needs to scramble for control over a particular selector. In these cases, there is always the rule of the style sheet to gain control over. The following attributes will determine the results of the opposite style sheet.

As mentioned before, Web page makers and readers have the ability to specify style sheets. When the rules of the two collide, the Web page maker's rules override those of the reader's other same weights. Web page makers and readers have style sheets that go beyond the browser's built-in style sheet.

Web page makers should be careful to use! Important rules, because they will go beyond the user any! Important rules. For example, a user may require a large font or a specified color due to a visual relationship, and such a user would have the possibility to declare a defined style rule for! Important, because these styles are extremely important for users to read Web pages. Any of that! Important rules go beyond general rules, so it is recommended that web makers use general rules to ensure that users with special styles need to be able to read Web pages.

Selector rules: The calculated attributes are based on their attribute level, and the style sheet can transcend the style sheet that conflicts with it, and a style with a higher feature always overrides a lower-feature style. This is just a statistical game that calculates the specified number of selectors.

Number of ID attributes in the statistics selector.

The number of class attributes in the statistics selector.

The HTML tag name format in the statistics selector.

Finally, write three numbers in the correct order, without spaces or commas, and get a three-digit number. (Note that you need to convert the number to a larger number that ends with three digits.) The final list of numbers corresponding to the selector can easily determine that a higher numeric attribute overrides a lower number. The following is a list of selectors sorted by attribute: #id1 {XXX}/* a=1 b=0 c=0--> feature =/ul ul li.red {XXX}/* a=0 b=1 features = c=3-->-013 {XXX}/* a=0 b=1 c=1--> attribute = 011/LI {XXX}/* a=0 b=0 the c=1--> feature = 001 The Order of the features for ease of use, when two rules have the same weight, take the one behind.



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.