tags:

views:

51

answers:

6

input type=text/radio/checkbox - can I treat them differently in my CSS?

Other than by adding class= I mean

A: 

I've never seen this done (and I've personally tried). I believe you would have to have some JavaScript/jQuery run on the page post render to manipulate the classes of objects based on element attributes.

Brad
+3  A: 

You can use input[type=text] to do this. Old browsers might not support it though.

greg0ire
+2  A: 

Yes you can

eg

input[type="text"]{
/*do something*/
}

and more

input[type="text"] {
font:bold 10px/12px verdana,arial,serif;
padding:3px;
}
input[type="button"],input[type="submit"] {
/* you know what to do */
}
JapanPro
+5  A: 

YES!

With an awesome thing called attribute selectors:

input[type="text"] { width: 200px; }

Just change that text there and you're good to go!

But note that these don't work on IE6, so you might want to take a look at the dean.edwards.name IE7.js :)

Kyle Sevenoaks
+2  A: 

You can use the attribute selector, like this

input[type=text] { ... }

However, this is not supported in all browsers. Your safest bet is to use a class

Jimmy
+1  A: 

you can do input[type="text"]

Paul