Chrome allowed to resize text area by drugging that on the bottom right corner, but some times this movement may break design of the page, so i am wondering how to restrict the max and min width for that action of how to disable that function at all with thml/javascript/css on the page?
6 Answers
you can use :
resize: vertical; max-height: 200px; 3 Comments
naxo8628
the best solution for me!
ricks
This should be the selected answer. Disabling the resizing completely is really frustration for the user, you should be able to at-least resize vertically to some extent/
O-9
I'm here because that doesn't work. Using material design matInput (Angular)
textarea.vertical { resize: vertical; max-height: 130px; min-height: 80px; } textarea.horizontal { resize: horizontal; max-width: 130px; min-width: 80px; } <p>Horizontally resizable textarea</p> <textarea type="text" class="horizontal"></textarea> <br> <p>Vertically resizable textarea</p> <textarea type="text" class="vertical"></textarea> You can set the resize property as horizontal and vertical or set it as default(the user can stretch in both ways).
If you are setting resize: horizontal then you need to add the additional property as max-width:200px;
If you are setting resize: vertical then you need to add the additional property as max-height:200px;
2 Comments
shuberman
Your code snippet pertaining to horizontal resizing doesn't seem to work.
Aniket Sharma
@mishsx You need to increase the
max-width of a textarea in order to stretch it more. I just have provided the sample width
CSS-max-widthandmax-heightresize: noneunless you absolutely must. It's really very annoying indeed not to be able to resize tiny littletextareas.