Connecting Tech Pros Worldwide Help | Site Map

Getting textarea box to expand horizontally to fill TD

John Ramsden
Guest
 
Posts: n/a
#1: Jul 20 '05
I have a form containing a table whose cells include prompt
text strings and input areas, one of which is a textarea.

These are specified using only percent values, and I use
some simple javascript to expand the table to the available
window width. So whether the screen is maximized or partially
minimized, the table fits snugly in the available display.

The trouble is if I include a 'cols=' spec for the textarea box
its width stays fixed regardless of the actual window width,
which messes up my table width, and if I don't use a 'cols='
spec then the textarea decides to use a ridiculously small
value and the text ends up looking like that mouse tail poem
in Alice in Wonderland!

So is there a simple way, in HTML (preferably) or JavaScript,
to indicate that a textarea box should be rendered expanded
horizontally to fit the entire table cell?


Cheers

John Ramsden (john_ramsden@sagitta-ps.com)
Matthias Gutfeldt
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Getting textarea box to expand horizontally to fill TD


John Ramsden schrieb:[color=blue]
> So is there a simple way, in HTML (preferably) or JavaScript,
> to indicate that a textarea box should be rendered expanded
> horizontally to fit the entire table cell?[/color]

No, there's no attribute you could stick in a textarea for that purpose.
But you could try a stylesheet, something like this:

textarea {width:100%;}

Browser support may vary, as usual.


Matthias
Owen Jacobson
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Getting textarea box to expand horizontally to fill TD


John Ramsden wrote:
[color=blue]
> So is there a simple way, in HTML (preferably) or JavaScript,
> to indicate that a textarea box should be rendered expanded
> horizontally to fit the entire table cell?[/color]

Sure. In your stylesheet, add:

textarea {
width: 90%;
}

....you *are* using stylesheets for layout, right?
Closed Thread