TEXT vs. TEXTAREA? (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


pcguy -> TEXT vs. TEXTAREA? (12/7/2005 9:13:39)

Is there any way to affect ALL the "text" input areas (without affecting anything else) by using a tag like this:

INPUT
{
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
}
TEXTAREA
{
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
}

Obviously, this doesn't work:
TEXT
{
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}

I want to avoid using .mytextbox, because then I have to insert a class tag into each text input box...

Any help appreciated!




coreybryant -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:16:11)

Instead of text try using input




pcguy -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:18:00)

INPUT will affect ALL the input types, including checkboxes, textareas, etc...

I only want to affect TEXT inputs...

Maybe there is no way to do it without using a class tag?




coreybryant -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:25:06)

Sorry about that, I knew that but just got back in from shovelling snow :)

As far as I know, the answer is no. Of course, you could over-ride it in your CSS by applying a class to the other tags if the text boxes are more than the others to reduce the code




rdouglass -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:31:56)

quote:

INPUT will affect ALL the input types, including checkboxes, textareas, etc...

I only want to affect TEXT inputs...


I kinda' get around that by applying a style to INPUT then apply a style to TEXTAREA afterwards to override the INPUT style.

Seems to work good for me. I don't have to use class tags and I get the effect I want - textboxes different than textareas.




pcguy -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:35:51)

quote:

I kinda' get around that by applying a style to INPUT then apply a style to TEXTAREA afterwards to override the INPUT style


Ok, but how would you do it for a TEXT input box??? Textarea has a CSS selector (or whatever you call it), a Textbox does not (that I know of)...

So if I do an INPUT style, what do I put after it that will affect only TEXT boxes (not textarea boxes) ???

Thanks!




coreybryant -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:39:26)

You would need to give the apply that
<style type="text/css">
input.text
{
	border:1px solid #000; 
	background-color: #000;
	font-family: arial;
	font-size: 10pt;
	color: #fff;
}
</style>
I also asked here: Controlling the Input with CSS just in case they might have a few ideas.




pcguy -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:49:14)

Ok,

I'm convinced since there is no selector for only a "text" box, that there is no way to do it without inserting an id or class tag for every text box....

Thanks for all the quick input...(no pun intended) [:)]




coreybryant -> RE: TEXT vs. TEXTAREA? (12/7/2005 9:52:48)

the_pm had a couple of other suggestions as well if you have a unique ID attached to each one




rdouglass -> RE: TEXT vs. TEXTAREA? (12/7/2005 10:02:57)

quote:

Ok, but how would you do it for a TEXT input box??? Textarea has a CSS selector (or whatever you call it), a Textbox does not (that I know of)...


Exactly. The INPUT style affects textboxes as well as all other INPUT, yes. So I put my INPUT style first, then TEXTAREA to offset the INPUT. DO the same with CHECKBOX, BUTTON, and whatever other INPUT items you need to.

I know it doesn't seem efficient but if you have a large form (or lots of them) it can be more efficient thatn using class in the tag.

And you're right, you can't use the TEXT input item explicitly. That's the only workaround I'm aware of.




coreybryant -> RE: TEXT vs. TEXTAREA? (12/7/2005 10:27:35)

Or as they point out - wait for CSS3 and the support of CSS3




rdouglass -> RE: TEXT vs. TEXTAREA? (12/7/2005 10:37:42)

quote:

wait for CSS3 and the support of CSS3


and there's always that. [;)]

Personally, I hate waiting for anything. [8|]




Tailslide -> RE: TEXT vs. TEXTAREA? (12/7/2005 10:44:16)

Considering IE still isn't supporting CSS2 (1998ish?) properly I wouldn't hold your breath!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.347656E-02