Difference between revisions of "Cascade (CSS)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Created page with "In Cascading Style Sheets, the '''cascade''' refers to a set of principles which determine how style rules interact with HTML. == Basic principles == The Cascade (...")
 
Line 5: Line 5:
 
The [[Cascade (CSS)]] refers to the way that CSS deals with multiple style rules, when the rules apply to a single specific [[HTML element]].
 
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 ==
+
=== When rules do not conflict, they combine ===
  
 
Both rules apply, when they do not conflict with each other.
 
Both rules apply, when they do not conflict with each other.
  
=== When rules conflict, highest cascade weight wins ==
+
=== 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.
 
[[Cascade weight (CSS)]] is a measure of how important a rule is, among all rules which affect a give web page.
Line 17: Line 17:
 
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).
 
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.
+
More important, you should know the general principles of the cascade.  You will be able to judge the weight intuitively, with practice.
  
 
See also:
 
See also:
  
 
  http://code.karljones.com/docs/css/CSS-part-02.pdf
 
  http://code.karljones.com/docs/css/CSS-part-02.pdf

Revision as of 12:50, 8 March 2016

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:

http://code.karljones.com/docs/css/CSS-part-02.pdf