Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resizing TEXTAREA

Status
Not open for further replies.
CSS should let you do it. I cannot test this anywhere but Mozilla (where it works):

<textarea style=&quot;width: 50%; height: 200px;&quot;></textarea>

Mozilla keeps the textarea at 50% of the screen size. Hope it helps.
 
Not in CSS. If you want to change the number of rows dynamically, you'll have to use JavaScript.

Take Care,
Mike
 
You should be able to mix CSS and the rows attribute, like this:
[tt]
<textarea style=&quot;width: 50%;&quot; rows=&quot;5&quot;></textarea>
[/tt]
It'll annoy CSS purists, but probably makes a lot of sense - I want my textarea to be 5 lines of text high, and I can't predict how high (in pixels) the browser will make each line. Haven't tested it though...

-- Chris Hunt
 
Chris,

I agree with you that putting both tags in is a good move - certainly for maximum browser compatibility.

I'm not sure about CSS calculating the height of each line if you specify both. I thought that browsers always stuck to the pixel value specified by CSS width/height parameters, and that the rows/cols were only used by browsers that didn't understand CSS.

Can anyone clarify this?

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top