CSS: selecting an attribute value containing dashes

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.


Live test

This entry was posted in by Gabriele Romanato. Bookmark the permalink.

Leave a Reply

Note: Only a member of this blog may post a comment.