I want to disable the resizable property of a textarea
.
Currently, I can resize a textarea
by clicking on the bottom right corner of the
If you need deep support, you can use an old school technique:
textarea {
max-width: /* desired fixed width */ px;
min-width: /* desired fixed width */ px;
min-height: /* desired fixed height */ px;
max-height: /* desired fixed height */ px;
}
I found two things:
First
textarea{resize: none}
This is a CSS 3, which is not released yet, compatible with Firefox 4 (and later), Chrome, and Safari.
Another format feature is to overflow: auto to get rid of the right scrollbar, taking into account the dir attribute.
Basic HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<textarea style="overflow:auto;resize:none" rows="13" cols="20"></textarea>
</body>
</html>
Some browsers
You simply use: resize: none;
in your CSS.
The resize property specifies whether or not an element is resizable by the user.
Note: The resize property applies to elements whose computed overflow value is something other than "visible".
Also resize not supported in Internet Explorer at the moment.
Here are different properties for resize:
No Resize:
textarea {
resize: none;
}
Resize both ways (vertically & horizontally):
textarea {
resize: both;
}
Resize vertically:
textarea {
resize: vertical;
}
Resize horizontally:
textarea {
resize: horizontal;
}
Also if you have width
and height
in your CSS or HTML, it will prevent your textarea be resized, with a broader browsers support.
You can try with jQuery also
$('textarea').css("resize", "none");
In CSS ...
textarea {
resize: none;
}
<textarea style="resize:none" rows="10" placeholder="Enter Text" ></textarea>