textarea - disable resize on x or y?
Asked Answered
K

3

171

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

Kurbash answered 29/8, 2014 at 11:48 Comment(0)
S
284
resize: vertical;

or

resize: horizontal;

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

Secondly answered 29/8, 2014 at 11:50 Comment(0)
B
44

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

Byline answered 15/12, 2016 at 8:26 Comment(1)
Both the CSS and the jQuery solutions do the same thing, so you can pick which one works best for your situation. I mention it in case someone interprets that you have to use both.Arni
T
10

You must use horizontal or vertical values for property.

resize: vertical;

or

resize: horizontal;

Source: https://www.w3schools.com/cssref/css3_pr_resize.asp

Titanism answered 30/11, 2020 at 15:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.