When multiple style sheets are used, the style sheet needs to compete for control of a specific selector. In these cases, there will always be rules for style sheets to gain control. The following features determine the result of a different style sheet.
As previously mentioned, both web page makers and readers have the ability to specify style sheets. When the rules of the two conflict, the rules of the web page maker will prevail over other rules with the same weight of the reader. The style sheets of web page makers and readers go beyond the built-in style sheets of browsers.
Web page makers should be careful when using it! Impant Ant rules, because they will surpass any of the user's! Impant Ant rules. For example, a user may require a large font or a specified color due to the visual relationship, and such a user may declare a definite style rule! Important, because these styles are extremely important for users to read webpages. Any! Impant Ant rules go beyond general rules. Therefore, it is recommended that web page makers use general rules to ensure that users with special style requirements can read the web page.
Selection rule: computing features
Based on their feature levels, a style sheet can also go beyond the conflicting style sheet. A high-characteristic style always prevails over a style with a low feature. This is just a statistical game that calculates the specified number of selector.
Counts the number of ID attributes in the selector.
Count the number of CLASS attributes in the selector.
The HTML tag name format in the statistics selector.
Finally, write three numbers in the correct order. Do not add spaces or commas to get a three-digit number. (Note: You need to convert the number into a larger number ending with three digits .) The final number list corresponding to the selector can easily determine that a higher number is superior to a lower number. The following is a list of feature-specific delimiters:
# Id1 {xxx}/* a = 1 B = 0 c = 0 --> Feature = 100 */
Ul li. red {xxx}/* a = 0 B = 1 c = 3 --> Feature = 013 */
LI. red {xxx}/* a = 0 B = 1 c = 1 --> Feature = 011 */
LI {xxx}/* a = 0 B = 0 c = 1 --> Feature = 001 */
Order of features
For ease of use, when the two rules have the same weight, take the latter one.