CSS/Selectors/id selector

ID Selector

The ID selector represents an element with the id attribute whose value is a whitespace-separated list of words, one of which is exactly "idname".


#idname{ properties }

Point, Note

  • What makes attributes of type ID special is that no two such attributes can have the same value in a document.



   color: green;


  <h1>Not green</h1>
  <h1 id="pastoral">green</h1>

Css3 selectors id.png

CSS defines the ID selector in 6.5. ID selectors.

Last modified on 22 July 2011, at 14:05