CSS/Selectors/id selector

From W3C Wiki
< CSS‎ | Selectors
Revision as of 14:05, 22 July 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

CSS defines the ID selector in 6.5. ID selectors.