CSS3/Selectors/id selector

From W3C Wiki
Jump to: navigation, search

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

The CSS Selectors Level 3 specification defines the ID selector in 6.5. ID selectors.