Page 1 of 1

De Facto Standard for Input[type=text] Class

Posted: Fri Oct 02, 2009 2:33 pm
by JellyFish
As you may already know, IE6 (and I believe IE7, not sure about IE8 though) does NOT support CSS attribute selectors. That is, these:

Code: Select all

input[type=text] { /*...*/ }
So, the only way to select a input element with the type of text (input boxes, which is what I call them) I would need to add a class to them and write:

Code: Select all

input.text { /*..*/ }
But when I think about it, the class text doesn't seem to be very suitable, and almost sounds like a more textual element.

So! My question is this:

What's the de facto standard for a css class for this specific purpose? What classes should I give to each input element? Should I just go with .text for all input[type=text]'s and .button for all input[type=button]'s, and etc?

Any suggestions are appreciated. Thanks for reading.

Re: De Facto Standard for Input[type=text] Class

Posted: Fri Oct 02, 2009 3:23 pm
by pickle
The idea is to be as semantic as possible, so using .text and .button would seem to make sense.

Re: De Facto Standard for Input[type=text] Class

Posted: Fri Oct 02, 2009 3:47 pm
by JellyFish
pickle wrote:The idea is to be as semantic as possible, so using .text and .button would seem to make sense.
Does it? I wonder, because it would seem that anything that has the class "text" would have to be text. But I guess sense a input text box has text in it, it makes sense.

Okay I'll go with that. I just wanted to make sure that there might be some issues down the road if I used this class for this purpose.

PS: It almost seems like I get caught up with naming conventions so much that I need some concurrence by other developers, as if I'm always asking "I this good idea...Is this okay?" I wonder why that is and how I can get over that. :P

Re: De Facto Standard for Input[type=text] Class

Posted: Sun Oct 04, 2009 5:58 am
by kaszu
I usually use "text" and in CSS "input.text" for input and "div.text" for text blocks. Haven't had any problems with this.

Re: De Facto Standard for Input[type=text] Class

Posted: Mon Oct 05, 2009 9:59 am
by pickle
It's a good idea to use ".text" and ".button" as opposed to ".blue" and ".small_rounded" for classes. This future-proofs your classes because if you want to change how the site looks, you can change the .text class & the meaning can persist. Using ".blue" for example, won't be as meaningful if you change the text to black.