CSS Attribute Selectors

Written on August 13, 2003 – 5:30 pm

I first read about Attribute Selectors in a sample chapter of a book on CSS. Then I did a search on google to read more about it. What a great concept this is, if only it was supported by the browsers. Ok, I’m not 100% that it isn’t supported. The only documentation I can find is old. I think it was part of CSS2 which came out before IE6, but what I’ve read says that only Opera and certain builds of Mozilla are the only ones that support this fabulous trick.

It would basically mean you could use input[type=”text”] {color: red;} for example instead of assigning a class to every input field on a form. Much easier and it takes care of the pesky radio button, that forces you to not do input{border: 1px solid #000;} because then it puts an obnoxious circle around the radio button, instead of bordering the button like the rest of the form fields.

Has anyone tried to use this lately with IE? I’m leaning toward the sad fact that it won’t work, but as I mentioned above…I haven’t yet tried it.

Related Posts

    None Found

1 Comment

  • At 2003.08.14 08:30, Eric said:

    Sadly, Explorer does not support attribute selectors. When Longhorn comes out in 2005 (or 2006) the Web component MAY have improved its CSS support to include CSS2 selectors, but there’s no way to know. All known Gecko-based browsers, Opera, and Safari (thus probably Konqueror) all support attribute selectors. See http://www.meyerweb.com/eric/css/tests/css2/sec05-08-01.htm if you want to test browsers on their attribute selector support.

    Which book’s sample chapter did you read, by the way?

    (Required)
    (Required, will not be published)

    About the Author

    mamaLove is the personal site of Rayne Bair. Happily married since 2001 and proud mama of one adorable little girl. This site details a journey through motherhood and the discovery that there is life beyond being the mom. learn more ...

    Want to subscribe?

      Keep up with the latest at mamaLove.
    Search for entries: