homepage Welcome to WebmasterWorld Guest from 54.196.69.189
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

    
Styling a <textarea>
Can you override rows and cols with CSS?
Sarnix




msg:1211335
 7:39 am on Apr 16, 2003 (gmt 0)

Hi,

is it possible to manipulate the <textarea>-tag, so that i can give it a width and a height instead of rows and cols?

 

dmorison




msg:1211336
 7:44 am on Apr 16, 2003 (gmt 0)

Hi,

You can (at least in IE6 and the latest Mozilla), but I don't know where it stands as far as CSS standards / specifications are concerned.

le_gber




msg:1211337
 7:48 am on Apr 16, 2003 (gmt 0)

Yes just create a style like:
.textFormFields {width: 150px;} and assign it to all your form fields and they will neatly be aligned.

If you want to assign a height you will need to create another style otherwise your other form fields will have this height.

(I usually also assign font value because the textarea utilize a different type of font than the form fields)

Leo

dmorison




msg:1211338
 7:55 am on Apr 16, 2003 (gmt 0)

Just did a quick experiment;

It seems that the style attributes override rows and cols (as expected), so I would still include both to allow for graceful backward compatibility.

eg:

<textarea cols='20' rows='20' style='width:500px;height=500px;'>blah,blah,blah</textarea>

(or if you're using CSS apply the width and height via a class attribute of course)

Sarnix




msg:1211339
 9:15 am on Apr 16, 2003 (gmt 0)

Thanks for our your answers.
I think this suits best in my situation

style='width:100%;height:100%;'

It seems rather simple, but i don't know if i could have figured that out. At least not in such a short time.
It works excellent in IE and Mozilla. In Opera the height is the height that is needed for the text between the textarea tags. So <textarea style='width:100%;height:100%;'>some text</textarea>, would make the textarea 1 row high.
I try to find a solution for that. If i'll find I'll post it here.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved