> Is there a syntax to specify the checkbox styles without having to put
> class=something on each one ?
Sure it is: input[type="text"].
Of course, it doesn't work in IE.
Berislav
--
Berislav Lopac
Web developer
Jukka K. Korpela - 29 Jul 2003 22:58 GMT
> Sure it is: input[type="text"].
Beware that in addition to being completely unsupported by IE,
the selector does not match an input element that has the type
attribute _defaulted_. It is very common to default it, and quite OK by
all HTML specifications.
You could specify declarations for 'input[type="checkbox"]' and other
types that you actually use, and use the plain selector 'input'
to specify the declarations that should be applied to text input
fields. This requires that the rules for 'input[type="checkbox"]'
override anything set in the rule for 'input' and not meant to apply to
other than text input elements.

Signature
Yucca, http://www.cs.tut.fi/~jkorpela/
> Suppose I want one set of styles for text input and another set of
> styles for checkbox input.
[snip]
> If possible, I'd like to avoid having to add
>
> class=mumble
>
> to each one
[snip]
> Is there a syntax to specify the checkbox styles without having to put
> class=something on each one ?
Yes there is. They are called attribute selectors:
<URL:http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors>
Example:
input[type=text] {
...
}
Unfortunately, there is a small company called Microsoft out there, who make
a niche browser called Internet Explorer (you may have heard of it). Being
such a small company, they haven't been able to allocate the resources
needed to support this part of the CSS 2 specification, despite having had
over half a decade to do so.
In other words, stick with classes if you want it to work for Internet
Explorer users.

Signature
Jim Dabell