CSS/Selectors/attribute selector/attribute$=value

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

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

[attributename$="val"]

This selector represents an element with the "attributename" attribute whose value ends with the suffix "val".


Syntax

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


Point, Note

  • If "val" is the empty string then the selector does not represent anything.


Example

[style.css]

 a[href$=".pdf"]::after{
   content: "(Note that is a link to PDF.)";
 }

[index.html]

<body>
  <p>Go to <a href="http://www.example.com/example.pdf">documentation.</a><p>
</body>

Css3 selectors att 006.png

CSS defines the attribute selector in 6.3.2. Substring matching attribute selectors.