CSS Specificity Calculator
Work out the specificity of any CSS selector. Specificity is the score the browser uses to decide which rule wins when several target the same element. Put one selector per line to compare them and see which one takes priority.
#header .nav aspecificity 1,1,1wins1ID1Class1Typenav ul li aspecificity 0,0,40ID0Class4Type.nav a.linkspecificity 0,2,10ID2Class1Type
- ID - counts every
#idselector. - Class - counts classes, attribute selectors, and pseudo-classes like
:hover. - Type - counts element names and pseudo-elements like
::before.
Compare left to right: any ID beats any number of classes, and any class beats any number of type selectors. The universal selector * and combinators add nothing.