I need to use a textarea to show some text. The problem is that if I place 4-5 rows of text a scrollbar will appear. How can I use CSS/HTML so that the textarea will be as large
I´m afraid you´ll have to resort to javascript to set the height of your textarea. You can use the scrollHeight
property to determine the total height.
Alternatively you could just use a div
and style the div
to look like a textarea. The div
will grow automatically and as it´s a disabled textarea anyway, you don´t really need it to be a textarea.