CSS Specificity

Posted on

This is old-hat now but it’s still useful.

The actual specificity of a group of nested selectors takes some calculating. Basically, you give every id selector (“#whatever”) a value of 100, every class selector (“.whatever”) a value of 10 and every > HTML > selector (“whatever”) a value of 1. Then you add them all up and hey presto, you have the specificity value.

Via HTML Dog