CSS specificity subset

Count ID, class and type weights in simple CSS selectors and display specificity tuples.

The example value has been entered. Check it immediately or change the value.

Input is processed in the browser. Refreshing returns a sample value.

Result

Instructions and example

No. Supported nonfunctional pseudo-classes add to the class column, while pseudo-elements add to the type column. Combinators and universal selectors add no weight.

#app .card has specificity 1,1,0; .card:hover has 0,2,0; main article.card has 0,1,2.

Functional pseudos, attributes, escapes and lists are rejected. This does not compute final styles across inheritance, important declarations, layers or source order.

Frequently asked questions

Do pseudo-elements and pseudo-classes have the same weight?

No. Supported nonfunctional pseudo-classes add to the class column, while pseudo-elements add to the type column. Combinators and universal selectors add no weight.

Are :is(), :where() and final cascade order calculated?

Functional pseudos, attributes, escapes and lists are rejected. This does not compute final styles across inheritance, important declarations, layers or source order.

Calculation criteria and reference materials

Verification of calculation criteria: · Calculation·verification principles · Report errors