Read common selectors
#A space selects descendants; > selects direct children; + selects an adjacent following sibling. Classes and attributes express different matching conditions.
Fragment
Reference
Look up semantic HTML, forms, CSS layout, events, DOM operations and common browser APIs.
Modern browser platform examples, independent of a framework. HTML/CSS excerpts belong in the appropriate document/style context; DOM snippets assume a browser and named elements/data; TypeScript annotations clarify DOM types and need compilation or removal in plain JavaScript. Check target-browser support for newer features.
A space selects descendants; > selects direct children; + selects an adjacent following sibling. Classes and attributes express different matching conditions.
Fragment
Origin, importance and cascade layers are considered before selector specificity. Specificity compares ID, class/attribute/pseudo-class, then type/pseudo-element components. Equal-priority ties can use source order.
Fragment
Inline declarations and !important have their own cascade positions. Specificity is not a single universal numeric weight.
:where contributes zero specificity. :is and :has take specificity from their argument selector list under their defined rules. :has selects a relative relationship, not only ancestors in a fixed DOM direction.
Fragment
Check browser support and avoid unnecessarily expensive broad relational matching.
Custom properties participate in cascade/inheritance and are substituted with var(). The fallback applies to an absent/invalid custom property, not every final property-value error.
Fragment
Visible focus identifies the active keyboard target. Respect reduced-motion preferences when animation is not necessary to convey state.
Fragment
Keep a useful focus indicator across themes. Reduced motion should preserve access to the resulting state.