Forum Moderators: not2easy
In theory, this:
input[type="radio"] { border-style:none; }
input[type="text"] { border:1px solid #000; }
...should do what you like. But since IE doesn't support attribute selectors, you can take Tedster's suggestion [webmasterworld.com] and do one of the following:
CSS:
input { border-width: expression(this.type=="text"? '1px' : '0'); }Translation: "if this is an input element with the 'type' attribute set to 'text' then set the 'border-width' property to '1px', otherwise, set it to '0'."
CSS:
input.text { border-width:1px; }
input.radio { border-width:0; }
HTML:
<input type="radio" class="radio" />
<input type="text" class="text" />
Neither solution is ideal; if a visitor's browser has javacript disabled or cannot execute javascript (think of e.g. phones...), then method 1 simply will not work.
Method 2, on the other hand, should work in any css enabled browser, but on large forms could add quite a lot of overhead because of the need to add extra markup on all or many form elements...
-B
Incidentally, though I would have thought that quotes should be used when using attribute selectors in css (e.g. 'input[type="text"] { ... }', the actual spec implies that they need not be. The examples on the attribute selector page in the css 2.1 spec include these:
*[lang=fr] { display : none }
*[langĻ="en"] { color : red }