27

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?

2
  • 1
    you can use CSS - max-width and max-height Commented Aug 26, 2011 at 12:29
  • 4
    You shouldn't use resize: none unless you absolutely must. It's really very annoying indeed not to be able to resize tiny little textareas. Commented Aug 26, 2011 at 13:39

6 Answers 6

39

you can use :

resize: vertical; max-height: 200px; 
Sign up to request clarification or add additional context in comments.

3 Comments

the best solution for me!
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/
I'm here because that doesn't work. Using material design matInput (Angular)
25

You can also restrict to horizontal resizing only with:

resize: horizontal; 

and only vertical resizing with:

resize: vertical; 

Comments

21

You can disable re-sizing it with the following css:

resize: none; 

Comments

18

This is all a matter of CSS. To disable the resizing (drag thumb) just use resize: none;. To restrict size max(min)-width and height should do the trick.

Comments

3

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

Your code snippet pertaining to horizontal resizing doesn't seem to work.
@mishsx You need to increase the max-width of a textarea in order to stretch it more. I just have provided the sample width
2

you can use

resize:none 

to restrict the resizing of a textarea.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.