Javascript 如何在 chrome 中限制最大 textarea 宽度和高度或如何禁用 textarea 调整大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7204584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to restrict max textarea width and height in chrome or how to disable textarea resizing
提问by Joper
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?
Chrome 允许通过在右下角添加药物来调整文本区域的大小,但有时这种移动可能会破坏页面的设计,所以我想知道如何限制该操作的最大和最小宽度如何完全禁用该功能与thml/javascript/css
在网页上?
采纳答案by MattW
You can disable re-sizing it with the following css:
您可以使用以下 css 禁用重新调整大小:
resize: none;
回答by Jeremy Lynch
You can also restrict to horizontal resizing only with:
您还可以限制为仅水平调整大小:
resize: horizontal;
and only vertical resizing with:
并且只有垂直调整大小:
resize: vertical;
回答by Ouadie
you can use :
您可以使用 :
resize: vertical;
max-height: 200px;
回答by Z. Zlatev
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.
这完全是 CSS 的问题。要禁用调整大小(拖动拇指),只需使用resize: none;
. 限制大小max(min)-width
,height
应该可以解决问题。
回答by user2198974
you can use
您可以使用
resize:none
to restrict the resizing of a textarea
.
限制调整 a 的大小textarea
。