selector

id — CSS reference

Matches an ID value. HTML IDs should be unique; duplicated IDs can still match the selector. Escape identifiers that are not valid CSS identifiers.

Formal Syntax & Structure

css syntaxcss
#identifier

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }#a { color: rgb(0, 96, 80); }</style></head><body><p id="a" class="sample">A</p><div id="b" class="sample">B</div></body></html>
CSS Reference