CSS #id Selector

Complete CSS Reference Complete CSS Reference

Example

How to 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.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The #id selector is supported in all major browsers.


CSS Version

The #id selector was first introduced in:

CSS 1


Complete CSS Reference Complete CSS Reference