Cascade weight (CSS)

From Wiki @ Karl Jones dot com
Jump to: navigation, search

In Cascading Style Sheets, cascade weight refers to the numeric value of a CSS rule.

Cascade weight is a measure of how important a rule is, among all rules which affect a give web page.

CSS Cascade

The Cascade (CSS) refers to the way that CSS deals with multiple style rules, when the rules apply to a single specific HTML element.

When rules do not conflict, they combine. Both rules apply, when they do not conflict with each other.

When rules conflict, the rule with the highest cascade weight wins

When two or more rules conflict, the rule with the highest Cascade weight (CSS) applies. The other rules are ignored.

Web designer advice

It is not necessary to calculate, or know, the numeric value of the weight (although you can look it up using Inspect Element), if you are curious).

More important, you should know the general principles of the cascade. You will be able to judge the weight intuitively, with practice.

See also

External style sheets