Cascade (CSS)

From Wiki @ Karl Jones dot com
Revision as of 11:55, 8 March 2016 by Karl Jones (Talk | contribs) (See also)

Jump to: navigation, search

In Cascading Style Sheets, the cascade refers to a set of principles which determine how style rules interact with HTML.

Basic principles

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, highest cascade weight wins

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

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

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 links