CSS Attribute Selectors
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.






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?