Specificity examples
| Selector | Specificity |
|---|---|
| p | 0,0,1 |
| .btn | 0,1,0 |
| #nav a | 1,0,1 |
| :where(.card) h2 | 0,0,1 |
| a:hover::before | 0,1,2 |
Related tools
Frequently asked questions
What is CSS specificity?
The weight a browser gives a selector to decide which rule wins when several set the same property.
How is specificity written?
As three numbers (IDs, classes/attributes/pseudo-classes, types/pseudo-elements), compared from left to right.
Does one ID beat many classes?
Yes – any number of classes cannot outweigh a single ID, because the columns are compared in order.
How do :is(), :not() and :has() count?
They take the specificity of their most specific argument.
How does :where() count?
It always adds zero – useful for low-priority defaults that are easy to override.
What about the universal selector and combinators?
*, >, + and ~ add nothing.
Where do inline styles and !important fit?
Inline styles beat any selector, and !important beats normal declarations. Cascade layers and source order also matter.
How is :nth-child(2n of .x) counted?
It counts as a pseudo-class plus the most specific selector in its “of” list.
Do attribute selectors count as classes?
Yes – [type="text"] has the same weight as a class.
Why does my rule still not apply?
Check for !important, inline styles, cascade layers, the order of stylesheets, or a typo in the selector.
Is this the same as browser devtools?
It follows the same specification (Selectors Level 4); devtools show specificity on hover in some browsers.
Is anything uploaded?
No.
Is it free?
Yes – no sign-up, no limits and no watermark.
Is my code uploaded?
No. Everything runs in your browser; nothing you paste is sent to Docelora.
Can I use the output in commercial projects?
Yes. The output is yours to use however you like.
Does it work on a phone or tablet?
Yes – the layout adapts to small screens, though long code is easier to read on a larger display.
How do I copy the result?
Use the Copy button under the result, or Download to save it as a file.
Which browsers are supported?
Current versions of Chrome, Edge, Firefox and Safari.
Is there a size limit?
There is no fixed limit, but very large inputs can take a few seconds on older devices.
Can I suggest an improvement?
Yes – use the Contact page to tell us what would make the tool more useful.
Last reviewed: 15 November 2026.