Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable textarea resizing?

Tags:

html

css

People also ask

How do I restrict textarea size?

You can set the size of a text area using the cols and rows attributes. To limit the number of characters entered in a textarea, use the maxlength attribute. The value if the attribute is in number. Specifies that on page load the text area should automatically get focus.

How do I set the fixed size textarea in HTML?

A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier). The size of a text area is specified by the <cols> and <rows> attributes (or with CSS).

How do I stop a DIV from resizing?

It is mostly used with textarea and div elements. To disable resizable property of an element use resize to none.

Can you disable a textarea?

In order to disable a textarea (or any other input element), you can: In HTML, you can write: <textarea id='mytextarea' disabled></textarea> From jQuery, you can: $("#mytextarea"). attr("disabled","disabled");


You can use css

disable all

textarea { resize: none; }

only vertical resize

textarea { resize: vertical; }

only horizontal resize

textarea { resize: horizontal; } 

disable vertical and horizontal with limit

textarea { resize: horizontal; max-width: 400px; min-width: 200px; }

disable horizontal and vertical with limit

textarea { resize: vertical; max-height: 300px; min-height: 200px; }

I think min-height should be useful for you


With some css like this

textarea
{
   resize: none;
}

Or if you want only vertical

textarea { resize:vertical; }

Or horizontal

textarea { resize:horizontal; } 

or both ( not your case)

textarea { resize:both; } 

You can put this in the CSS file:

textarea {
  resize: none;
} 

disable horizontal and vertical with limit

textarea { 
    width:100%;
    resize:vertical; 
    max-height:250px; 
    min-height:100px; 
}