CSS #id Selector

Definition and usage

CSS #id Selector is used to select elements with the specified id.

Example

Select and set the style of the element with id="firstname":

#firstname {
  background-color: yellow;
}

Try it yourself

CSS syntax

#id {
  css declarations;
}

Technical details

Version: CSS1

Browser support

Chrome Edge Firefox Safari Opera
Støtte Støtte Støtte Støtte Støtte

Relaterede sider

CSS undervisning:CSS id vælger

CSS undervisning:CSS id vælger detaljeret