Justify Text in a HTML/XHTML TextArea

Matt picture Matt · Jan 9, 2009 · Viewed 32.7k times · Source

I am currently trying to justify text in a textarea, unfortunately the CSS:

text-align: justify;

Doesn't work on the text like center, left and right do. I've tried this in both Firefox 3 and IE 7 with no luck.

Is there any way around this?

Answer

shweta picture shweta · Mar 9, 2011

I dealt with same issue and found out very stupid solution. Make sure that the text to be displayed falls within the start and end tag elements in the same line and not in the next line

<textarea  name="description" readonly="readonly" rows="4" cols="66">Text aligned toward left</textarea>

and not like

<textarea  name="description" readonly="readonly" rows="4" cols="66">
Text aligned toward left
</textarea>