The Cascade

W3 Schools Reference Page

CSS Home

You might have noticed that styles can be specified at four levels:

  1. tag selector
  2. class selector
  3. id selector
  4. an individual element's style attribute

Styles lower on the list override styles at the top of the list. For example, if you specify a color with a tag selector, it will be overridden by the color within a class selector. This is what is referred to as the cascade.

Compare the results for the following examples with the source code for this page:

The Cascade Explained