Understanding Cascade, Inheritance, and Specificity

What is Specificity?

  • An element selector is less specific — it will select all elements of that type that appear on a page — so will get a lower score.
  • A class selector is more specific — it will select only the elements on a page with a specific class attribute value, so it will get a higher score.

What is Cascade?

What is Inheritance?

How to deal with it?

  1. Order
  2. Specificity
  3. Importance

Let's talk about “!important”

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store