CSS selector tester
Paste HTML on the left, type a selector on the right. Scripts are stripped before parsing — HTML is never rendered as a live page.
~~~
HTML
Selector
Specificity:Calculator
Matches
element(s) matched
Source highlight
Selector reference
- :has()
- :has(.icon) — parent if it contains a match
- :is() / :where()
- :is(h1, h2, h3) — pick one; :where() counts as zero specificity
- :nth-child(An+B of S)
- li:nth-child(2n+1 of .active)
- Attribute
- [href^="https"] [data-state="open"]
- Combinators
- .a > .b (child), .a + .b (adjacent), .a ~ .b (sibling)
~~~
About this tool
Test selectors against sample markup before you ship CSS. The HTML is parsed with DOMParser in memory — script tags are removed and nothing runs in the page.
For full specificity breakdowns across multiple selectors, use theCSS specificity calculator.
~~~