Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove scrollbars from textarea

Following up to my previous question (Add a scrollbar to a <textarea>) on how to always see the scrollbar in a <textarea>, I am now wondering how you would set it so that there is no scrollbar in the <textarea>, even when the text overflows. To scroll down with this, you would use the arrow keys or the mouse to navigate through the text.

How can I do this?

like image 641
user2370460 Avatar asked Oct 17 '13 11:10

user2370460


People also ask

How can I remove horizontal scrollbar from textarea?

To prevent the resizing of the textarea you can use resize: none . To avoid scrollbars you can use overflow: hidden or just overflow-x: hidden to hide them only horizontally.

How do I stop textarea from scrolling?

Re: Is it possible to disable textarea auto grow and show scrollbar. you can add data-role="none" to the textarea tag.

How do I enable scroll disabled in textarea?

the easiest way would be to use "readonly" instead. another way would be to use a fixed-height div will overflow:scroll that looks like a textarea but isn't.


2 Answers

Try the following, not sure which will work for all browsers or the browser you are working with, but it would be best to try all:

<textarea style="overflow:auto"></textarea> 

Or

<textarea style="overflow:hidden"></textarea> 

...As suggested above

You can also try adding this, I never used it before, just saw it posted on a site today:

<textarea style="resize:none"></textarea> 

This last option would remove the ability to resize the textarea. You can find more information on the CSS resize property here

like image 63
tinthetub Avatar answered Sep 17 '22 14:09

tinthetub


style="overflow: hidden" and style="resize: none" were the ones that did the trick.

like image 36
Dinder Logic Avatar answered Sep 18 '22 14:09

Dinder Logic