Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

textarea - disable resize on x or y?

I know it's possible to disable the resize of a textarea by using:

textarea {
    resize: none;
}

But is it possible to disable either x or y? instead of both

like image 423
SaturnsEye Avatar asked Oct 14 '22 03:10

SaturnsEye


People also ask

How do I make my textarea not resizable horizontally?

To prevent a text field from being resized, you can use the CSS resize property with its "none" value. After it you can use the height and width properties to define a fixed height and width for your <textarea> element.

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).


2 Answers

resize: vertical;

or

resize: horizontal;

Quick fiddle: http://jsfiddle.net/LLrh7Lte/

like image 259
Grim... Avatar answered Oct 16 '22 17:10

Grim...


Sure it is possible with css and jquery

CSS:

resize: vertical;
resize: horizontal;

jQuery

$('textarea').css("resize", "vertical");
$('textarea').css("resize", "horizontal");

Bootstrap just put the class in Textarea

for the vertical resize: vresize

for the horizontal resize: hresize

like image 43
Santosh Khalse Avatar answered Oct 16 '22 17:10

Santosh Khalse