CSS: ID selector (#)

By Xah Lee. Date: . Last updated: .

match ID attribute's value

tag#val

match the value of a attribute id

same as

tag[id="val"]

tag here is compound selector, or none, which means the universal selector (* any tag).

🟒 TIP: normally you don't need the tag, because ID attribute should be unique on a page. There is only one element with a given ID value.

#x2795 {
 border: solid 1px grey;
}

CSS. Selectors

Selector types
Simple selectors
Combinators
Selector list
Special selector
Misc