View Full Version : TextArea Background

12-06-2005, 07:56 PM
Is there any way to set the background of the TextArea element? I can't see it in the W3C HTML docs. I would like to set it to transparent.


12-06-2005, 08:03 PM
<textarea style="background:none;color:#000;" rows=5" cols="8"></textarea>

12-06-2005, 08:08 PM
Thanks again!

Is this stuff documented somewhere?

12-06-2005, 08:29 PM
Yes its CSS2.0-2.1 Search on www.w3.org for the CSS2.1 specs. You can learn about CSS at w3schools as well.

12-07-2005, 02:06 AM
I've looked through the W3C docs but perhaps I just don't understand them. I couldn't find any reference to background being one of the properties of the Textarea element.

And is there some way that class references are supposed to work? Like this?

<TEXTAREA class="TestimonialInput" rows=14 cols=100 name=Testimonial></TEXTAREA>

Or like this?

<SPAN class="TestimonialInput"><TEXTAREA rows=14 cols=100 name=Testimonial></TEXTAREA></SPAN>

I tried both, of course, and neither works. Just wondering how to, or if I can, apply an external style sheet.

12-07-2005, 03:17 AM
What I used is inline styles which is CSS. Style is an html attribute but anything within the style is CSS which is why you don't find background as an attribute for the textarea. You would use a class if you were using an embedded or external stylesheet.

<textarea class="TestimonialInput" rows="14" cols="100" name="Testimonial"></textarea>
would be the correct markup which goes in your body tags, then in your stylesheet (css) you would call up the class by using a . (dot) in front of the class name

<style type="text/css">
.TestimonialInput {
The above code will go in your head tags.

12-07-2005, 08:23 AM
Well, now it works. I must have failed to save the .CSS file or clear a buffer or something. I don't know. Anyway, thanks for your patience. I've got a class defined in my .CSS and I've applied it to the textarea. The rest is all refinement.