Attribute Selectors

You can’t use some handy CSS selectors like:

  1. input[type=”text”] for selecting text input elements or
  2. abbr[title] for selecting all <abbr> tags with a title attribute or
  3. a[href$=”.pdf”] for all links that point to pdf files

div#column and div[id=”column”] are equivalent selectors, but one doesn’t work in IE6. Handy for when you want to apply a style for everything else.

24 ways has an article from 2005 that talks about some nifty things you can do with attribute selectors.

4 thoughts on “Attribute Selectors”

  1. h1:before {content:”Caution!”;color:#ff0000;}

    will add “Caution!” before content in h1 style.
    (there is also the element :after)

    this doesn’t work in IE 6, and i hate this fucking Browser for that!

    I love the IE Death March. 😉

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>