CSS · Selectors and cascade

#id selector

Targets the one element with that id. Prefer classes for styling; ids are for anchors and labels.

Syntax
#hero { … }

Example

Try it

Notes

#hero has high specificity. Overusing it makes overrides painful.

More in this group

::after ::before ::placeholder ::selection :active :checked :disabled :empty

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course