CSS/Selectors/attribute selector/attributel=value

From W3C Wiki
< CSS‎ | Selectors
Revision as of 19:04, 26 September 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This selector represents an element with the "attributename" attribute, its value either being exactly "val" or beginning with "val" immediately followed by "-".


elementname[attributename|="val"]{ properties }

Point, Note

  • This is primarily intended to allow language subcode matches.


The following selector represents an a element for which the value of the hreflang attribute begins with "en", including "en", "en-US", and "en-scouse":


   font-style: italic;


  <p><a href="http://www.w3.org/" hreflang="en-US">W3C</a> is an international community</p>

Css3 selectors att 004.png

CSS defines the attribute selector in 6.3.1. Attribute presence and value selectors.