Textarea resize

后端 未结 1 1456
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 01:19

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

相关标签:
1条回答
  • 2021-02-15 01:55

    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.

    0 讨论(0)
提交回复
热议问题