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



SHARE THIS PAGE

COLOR PICKER

colorpicker





Search w3schools.com:

Translate w3schools.com: