Cascading order of CSS

Filed under: CSS Stylesheets

In CSS, it’s possible to have more than one style specified for a HTML element. In simple terms, all styles, no matter how it’s specified will “cascade” down into one virtual stylesheet. This means you can define styles in an external style sheet, an internal stylesheet or inside a HTML element and all these styles will cascade down into one “master” stylesheet.

The order, from lowest to highest priority, is as follows:

  1. Browser default
  2. External stylesheet (.css file)
  3. Internal stylesheet (between the tags)
  4. Inline style (inside a HTML element)

Therefore, an inline style will override a style declared in an internal stylesheet, external stylesheet and in the browser default.

divider

Leave a Comment