Specificity calculation

Count ids, then classes, then tags; compare left to right.

How is specificity worked out?

Specificity is counted in three columns: ids, then classes/attributes/pseudo-classes, then tag names. Compare left to right; the first bigger number wins.

#nav .item a    /* 1 id, 1 class, 1 tag  = (1,1,1) */
.nav .item a    /* 0 ids, 2 classes, 1 tag = (0,2,1): loses */

Level: Freelancer · More CSS terms at this level

Updated