Cascade Basics

Style rules can be applied from more than one source which usually are

  • The browser’s default look and feel
  • A user-defined style sheet
  • A style sheet created by the website’s developer
Hence, it is essential to define an order of precedence as to which rule from which source will apply.
Style from the browser are the weakest and it applies default styles like the default font and text color, spacing between lines of text or between letter of text.
Style can also be a user-defined to specify user’s own look and feel like for visually disabled persons. It takes precedence over the browser’s style sheet.
Styles given by web page developer specify a style sheet and takes precedence over the user’s and the browser’s style sheets.
The style attribute of an HTML element applies styles directly to an element and has more precedence than any styles defined.
The precedence of a style is found by how specific a selector is and is explained in the figure as
Cascade Basics

Get industry recognized certification – Contact us

Menu