我想禁用文本区域的可调整大小属性。

目前,我可以通过单击文本区域的右下角并拖动鼠标来调整文本区域的大小。如何禁用此功能?


当前回答

正在添加!重要的使其发挥作用:

width:325px !important; height:120px !important; outline:none !important;

大纲只是为了避免某些浏览器上的蓝色大纲。

其他回答

如果你需要深度支持,你可以使用一种老式的技巧:

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;
}
<textarea style="resize:none" rows="10" placeholder="Enter Text" ></textarea>

您需要在component.CSS中设置以下CSS代码

textarea {
    resize: none;
}

使用此属性调整大小:无;

textarea {
  resize: none;
}
textarea {
  resize: none;
}

上面的代码将禁用项目中所有<textarea/>元素的可调整大小属性。如果您希望这样做很好,否则您将希望为textarea元素使用特定的类。

.not-resizable {
   resize: none;
}

在HTML中

<textarea class="not-resizable"></textarea>