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.
! Important
Rules can be specified with the! Important refers to the important. A style that is especially important overrides the other same weights that are opposite. Similarly, when web-makers and readers specify important rules, the rules of web-makers will go beyond the reader's. The following is! Examples of important declarations:
Body {background:url (bar.gif) white;
Background-repeat:repeat-x! IMPORTANT}
Origin of Rules (Author ' s vs. Reader ' s)
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: Calculating attributes
Based on their attribute levels, style sheets can also transcend style sheets that conflict with them, 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 the selectors sorted by attribute:
#id1 {XXX}/* a=1 b=0 c=0--> characteristic = 100 * *
UL ul li.red {XXX}/* a=0 b=1 c=3--> characteristic = 013 * *
li.red {XXX}/* a=0 b=1 c=1--> feature = 011 * *
LI {XXX}/* a=0 b=0 c=1--> characteristic = 001 * *
Order of attributes
For ease of use, when two rules have the same weight, take the one behind.