Selector Playground
Type a CSS selector. See every part, its specificity, and what to watch out for.
Up to 1,000 characters. The breakdown updates locally as you type. No input is put in the URL.
Specificity
#nav .link:hover > a::before- (1,2,2)
Selector anatomy
Selector 1: #nav .link:hover > a::before (1,2,2)
| Part | Kind | IDs | Classes | Types | Why |
|---|---|---|---|---|---|
#nav | ID | 1 | 0 | 0 | Adds 1 to the first column. |
space | Combinator | 0 | 0 | 0 | Combinators add nothing. |
.link | Class | 0 | 1 | 0 | Adds 1 to the second column. |
:hover | Pseudo-class | 0 | 1 | 0 | Adds 1 to the second column, like a class. |
> | Combinator | 0 | 0 | 0 | Combinators add nothing. |
a | Type | 0 | 0 | 1 | Adds 1 to the third column. |
::before | Pseudo-element | 0 | 0 | 1 | Adds 1 to the third column, like a type. |
| Total | 1 | 2 | 2 | (1,2,2) | |
Explainer
Read a selector
Underlines show the column: solid for IDs, dashed for the class column, dotted for the type column, double for functional pseudo-classes. Read how specificity is calculated.