• Home
  • blog
  • Do We Actually Need Specificity In CSS?

Do We Actually Need Specificity In CSS?

Category: Link

Philip Walton:

While it’s not possible to simply instruct the browser to ignore specificity altogether, it is possible to prevent specificity from affecting the cascade for a particular CSS file or set of CSS files.

How? The answer is to make specificity and source order the same.

Imagine a stylesheet in which all rules were ordered from least specific to most specific. In such a stylesheet, since the specificity of the rules also corresponds to the source order or the rules, specificity is effectively taken out of the equation.

Most arguments about the failures of CSS involve the global-ness and the pains of specificity. Thus most proposed solutions involve attempting to remove the global-ness or flatten specificity.

Direct Link to ArticlePermalink

Do We Actually Need Specificity In CSS? is a post from CSS-Tricks