How Specific is CSS Specificity?

Aug
19

You might remember Andy Clarke's article on "All that Malarky on CSS Specificity where he used Stormtroopers, Darth Vaders, and Emperors to provide a simple explanation to the way specificity works as Sith powers (with the amusing title of "Is it possible to learn these powers"). Now CSS Tricks have a slightly more mathematical view of the same theory in their "Specifics on CSS Specificity" article.

Their formula states:

  • Inline styles using style attribute = 1000 points
  • ID = 100 points
  • Class, pseudo-class, or attribute = 10 points
  • Element types = 1 point

So if we have .this_style td it would have 11 points, as opposed to #my_cell which would win with 100 points. Definitely an interesting article worth reading.

your comments - Post a comment

blog comments powered by Disqus