CSS Pseudo-Classes
78 CSS pseudo-classes curated from MDN Web Docs and the Selectors specifications, as of October 2026. Each entry includes the exact selector string (e.g. :hover, :nth-child()), a functional category such as state, structural, form, logical, linguistic, relational, shadow-dom, or paged-media, and a plain-English description of when and how the selector matches.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/css-pseudo-classes.json
Or use as a typed import:
import { cssPseudoClasses } from "https://staticdata.dev/v1/css-pseudo-classes.ts"
Formats
- JSON 13.9 KB
/v1/css-pseudo-classes.json
min: 12.0 KB · /v1/css-pseudo-classes.min.json
- CSV 8.8 KB
/v1/css-pseudo-classes.csv
- TypeScript 14.1 KB
/v1/css-pseudo-classes.ts
export const cssPseudoClasses
type PseudoClass = (typeof cssPseudoClasses)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| selector | string | CSS pseudo-class selector including leading colon | :hover |
| category | string | Functional category of the pseudo-class | state |
| description | string | Plain-English description of when the pseudo-class matches | Matches an element when the user designates it with a pointing device, such as hovering over it with a mouse. |
Preview
First 10 records.
| selector | category | description |
|---|---|---|
| :active | state | Matches an element that is being activated by the user, such as a link or button being clicked. |
| :active-view-transition | state | Matches the root element while a view transition is in progress. |
| :active-view-transition-type() | state | Matches the root element while a view transition with one of the given transition types is in progress. |
| :any-link | state | Matches any element that acts as a hyperlink source anchor, regardless of whether it has been visited. |
| :autofill | form | Matches input elements that have been autofilled by the browser. |
| :blank | form | Matches input elements that have an empty value. |
| :buffering | state | Matches media elements that are playing but temporarily stopped because they are loading data. |
| :checked | form | Matches radio, checkbox, or option elements that are checked or selected. |
| :current | state | Matches an element that is currently being displayed in a time-based media presentation (e.g., WebVTT cues). |
| :default | form | Matches form elements that are the default among a group of related elements (default button, default option, etc.). |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/css-pseudo-classes.json | jq '.[0]' import type { PseudoClass } from "https://staticdata.dev/v1/css-pseudo-classes.ts";
const res = await fetch("https://staticdata.dev/v1/css-pseudo-classes.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const cssPseudoClasses: PseudoClass[] = await res.json();
console.log(cssPseudoClasses[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/css-pseudo-classes.min.json") as r:
cssPseudoClasses = json.load(r)
print(cssPseudoClasses[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/css-pseudo-classes.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/css-pseudo-classes.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
This dataset is curated from MDN Web Docs, the authoritative reference for web standards maintained by Mozilla and contributors. It covers the pseudo-classes of CSS Selectors Level 3 and Level 4 and related specifications (Shadow DOM, paged media, media element states, view transitions, scroll markers), as of October 2026. Vendor-prefixed pseudo-classes are not included.
Each pseudo-class is assigned to one of eight functional categories: state (user-interaction states like :hover, :focus, :visited), structural (DOM-position selectors like :first-child, :nth-of-type()), form (form validation and input-state selectors like :valid, :required, :placeholder-shown), logical (combinators that reduce repetition like :is(), :not(), :where()), linguistic (language and directionality selectors like :lang(), :dir()), relational (context-aware selectors like :has(), :scope), shadow-dom (selectors for working inside Shadow DOM like :host, :state()), and paged-media (print-layout selectors like :first, :left, :right).
Functional pseudo-classes — those that accept arguments — are listed with empty parentheses in the selector field (e.g. :nth-child(), :is()) to indicate they require arguments at usage time. Experimental and draft-spec pseudo-classes with broad enough documentation on MDN (such as :popover-open, :user-valid, :state()) are included to give developers a complete reference.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
css-pseudo-classes changelog for this dataset's history.
Related datasets
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-pseudo-elements
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors