CSS selector

A pattern, such as .card, #menu or nav a, that picks which elements a CSS rule applies to or which elements a DOM query returns.

In more detail

Selectors can match by tag, class, ID, attribute, position and state, and combine these. The same syntax drives stylesheets and methods such as querySelector, matches and closest.

Related terms

Taught in

References