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



Color Picker

colorpicker