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?
You can disable re-sizing it with the following css:
resize: none;
you can use :
resize: vertical;
max-height: 200px;
You can also restrict to horizontal resizing only with:
resize: horizontal;
and only vertical resizing with:
resize: vertical;
You can disable re-sizing it with the following css:
resize: none;
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.
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;
max-width
of a textarea in order to stretch it more. I just have provided the sample width –
Faze you can use
resize:none
to restrict the resizing of a textarea
.
© 2022 - 2024 — McMap. All rights reserved.
CSS
-max-width
andmax-height
– Faustinaresize: none
unless you absolutely must. It's really very annoying indeed not to be able to resize tiny littletextarea
s. – Capetian