Vertically aligning text in a textarea

Bes

Bes

Soldato
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
Hi,

The above is driving me crazy- I cannot find a decent way (CSS/ Javascript/ jquery whatever) to get text to be vertically aligned to the centre of a text area- so even if the user types more text in, it stays vertically aligned to the centre.

Can anyone help?

Thanks
 

daz

daz

Soldato
Joined
18 Oct 2002
Posts
24,048
Location
Bucks
Correct me if i'm wrong, but this is one area where CSS falls down (or at least CSS with cross browser compatibility)... you may have to use a table with the text inside for this (valign = middle) IIRC. :o
 

daz

daz

Soldato
Joined
18 Oct 2002
Posts
24,048
Location
Bucks
Oh... inside the text area? Thought you meant alongside or something :o Ignore me then
 
Soldato
Joined
27 Oct 2002
Posts
3,538
Location
At the fulcrum of humdrum
Use the table cell to create a false textarea. Place the true textarea within that table cell [valign'ed, of course], with borders removed and with some padding in the cell to avoid the true textarea from going right to the edges.
 
Soldato
Joined
8 Oct 2005
Posts
4,185
Location
Midlands, UK
Use the table cell to create a false textarea. Place the true textarea within that table cell [valign'ed, of course], with borders removed and with some padding in the cell to avoid the true textarea from going right to the edges.

That's a good idea, but some browsers add a scroll bar to the right
 

Bes

Bes

Soldato
OP
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
hey would this method definately work? What do you mean by a false text area?

/noob

Thanks
 
Soldato
Joined
8 Oct 2005
Posts
4,185
Location
Midlands, UK
hey would this method definately work? What do you mean by a false text area?

/noob

Thanks

It might work in certain browsers, but some browsers add a disabled vertical scroll bar to text areas. Say you're making some sort of internal system where you know exactly what browser software people are using, you may get away with it.
 

Bes

Bes

Soldato
OP
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
It might work in certain browsers, but some browsers add a disabled vertical scroll bar to text areas. Say you're making some sort of internal system where you know exactly what browser software people are using, you may get away with it.

Afraid not, people could be using anything :(
 
Top Bottom