Reality of the point system

In reality though, the point system I'm describing is not completely truthful. Let's say you have this selector of 11 elements: div div p p p p p p p p p { ... }. Using the system I already described, this is worth 11 points. And I described a class selector as being worth 10 points. However, the long element selector will never beat one single class: .i-beat-any-number-of-elements. So technically, elements are worth 0,0,0,1 and classes are worth 0,0,1,0, ID's are worth 0,1,0,0, and inline styles are worth 1,0,0,0. But! Pause for emphasis. You'd be having a pretty bad experience if you ever created a selector consisting of more than 10 elements. That would be a very bad idea, and I recommend that you try not to ...

Get Mastering CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.