CSS #id Selector

❮ Previous Selectors Next ❯

Example

#example1 { 
  background-color: red;
}

#example2 { 
  background-color: green;
}

#example3 { 
  background-color: pink;
}

Meaning

The #id selector selects any tag with an id attribute set.

Note: The id attributes must have unique values, an ID selector can never match more than one element in a document.

Version: CSS1




Standard Syntax

#id {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







❮ Previous Selectors Next ❯