CSS #id Selector


Example

Style the element with id="firstname":

#firstname {
  background-color: yellow;
}
Try it Yourself »

Definition and Usage

The #id selector styles the element with the specified id.

Version: CSS1

Browser Support

Selector
#id Yes Yes Yes Yes Yes

CSS Syntax

#id {
  css declarations;
} Demo


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.