CSS 2.1 defines new attribute selectors that will be later enhanced in CSS3. One interesting feature is the capability of selecting an attribute value based on the presence of a dash-separated list of words, for example attr="one-two-three"
. This attribute selector, used in the form attr|="val"
, actually select the very first word of the list. For example:
p[id|="test"] {color: green}
You can see a live test below.