Selector
A CSS selector is the part of a CSS rule that identifies which elements a set of declarations should apply to.
Selectors can match element names, classes, IDs, attributes, states and document relationships. Selector choice affects maintainability and specificity.
How CSS chooses a target
Selectors can match element names, classes, IDs, attributes, states and document relationships. Selector choice affects maintainability and specificity. In practical terms, Selector belongs to the presentation and layout layer. Knowing that layer is important because it tells you what the term can change, what it cannot change, and where to look when something behaves unexpectedly.
Matching one element with a rule
.nav a targets links inside an element with class nav, while #header targets the element with the matching id.
Where selector choice affects maintainability
You do not need to memorize the term in isolation. It becomes useful when you can recognize it in the tool, browser, file or conversation where the concept is doing real work.
A selector is not specificity
A CSS selector is the part of a CSS rule that identifies which elements a set of declarations should apply to. By contrast, Specificity is the weighting system CSS uses when competing selectors from the same cascade origin and layer match the same element. The two can appear in the same project, but they describe different parts of the work and should not be used as interchangeable labels.
The mistake: writing broader selectors than the job needs
The common mistake is to use Selector as if it also meant Specificity. That blurs two separate decisions and usually sends troubleshooting in the wrong direction. A better test is practical: Prefer selectors that are specific enough to express ownership without creating unnecessary coupling to the entire document structure.
Why targeting strategy matters
In day-to-day work, Selector matters when the concept needs to be identified precisely instead of being grouped with a nearby term. The practical value is not the vocabulary itself; it is being able to identify the right control, file, setting or decision when the concept becomes relevant.
.nav a targets links inside an element with class nav, while #header targets the element with the matching id. That example is useful because it turns the definition into something you can recognize, test and discuss with other people working on the same project.
Related terms worth learning next
Sources and further reading
Use these references when you need documentation-level detail, specifications or product-specific behavior beyond the plain-English explanation above.