Can I distinguish CSS from different input types?

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

Besides adding class= I mean

+6
css
source share
7 answers

YES!

With a terrific thing called attribute selectors:

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

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

But note that they do not work on IE6, so you can take a look at dean.edwards.name IE7.js :)

+14
source share

You can use an attribute selector like this

 input[type=text] { ... } 

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

+5
source share

You can use input[type=text] for this. However, older browsers may not support it.

+4
source share

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 */ } 
+3
source share

you can do input [type = "text"]

+2
source share

you can use

 input[type="What ever the type you want to style specifically"] 
+1
source share

I have never seen this (and I personally tried). I believe that you will have to run JavaScript / jQuery on the post render page to manage feature classes based on element attributes.

0
source share

All Articles