CSS #id Selector

Definition and Usage

CSS #id Selector is used to select elements with 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
支持 支持 支持 支持 支持

相关页面

CSS 教程:CSS id 选择器

CSS 教程:CSS id 选择器详解