Thursday, August 20, 2015

css specificity

  • Elements and pseudo-elements (`a, div , body, :before, :after`) get a score of 1
  • Classes and attribute selectors (`.element, [type=”text”]`) get a score of 10
  • IDs (`#header`) get a score of 100
  • Inline styles get a score of 1000
  • `!important` gets a score of NaN (it’s more “specific”/powerful than even inline styles, and can only be overridden by the cascade — writing rules later in the stylesheet)
http://cssspecificity.com/

No comments:

Post a Comment