ID selector
A CSS selector that matches the one element with a given id attribute, written with a hash such as #menu.
In more detail
An id should be unique in a document, so an ID selector matches at most one element. ID selectors carry the highest specificity of the plain selectors, which makes rules that use them hard to override.
Related terms
- specificity — The weight the browser gives a CSS selector, used to decide which rule wins when two set the same property.
- class selector — A CSS selector that matches elements with a given class name, written with a dot such as .card.
Taught in
- The Cascade Algorithm: Specificity, Inheritance And Source Order — Frontend Architecture & Web Platform