Categories
Development

CSS Attribute Selectors

Attribute selectors which will hopefully become official when CSS 3 is passed are pretty cool. They work on most modern browsers, with the big exception being IE6/Win (not that I’d consider it modern by any means).

Here’s an example that applies a background image to a link only if it contains the pdf extension in it’s href

a[href$=".pdf"] {
background: url(../images/acrobat.png) no-repeat right top;
padding-right: 14px;
}

Leave a Reply

Your email address will not be published. Required fields are marked *