I know there is input[type=text], input[type=password]... But is there input[type=radio] or input[type=checkbox] ???

According to W3C this is possible, but my browsers (Firefox, IE, Chrome and Opera) don't seem to recognize the two aforementioned selectors at all.

Is this really possible, has anybody else used this method to style forms?

2 answers


Yes it is possible, this works for me in Firefox:

input[type=radio] {
    outline: 2px solid red;
input[type=checkbox] {
    outline: 2px solid blue;

Against HTML:

    <label>Checkbox: <input type="checkbox"></label>
    <label>Radio: <input type="radio"></label>

It may be that the things you are trying to style are not valid for these controls, or there are some other errors in your markup. Can you attach a full example?

Answered almost 9 years ago by Rob Crowther

Yes. My example had a border and background color. As it looks now, no "nice" and efficient pure CSS style can be applied to the fields. I guess it will be jQuery in the end as much as I tried not to.

Answered almost 9 years ago by campuscodi