我喜欢 Chrome 漂亮的文本区域调整大小控件。然而,一个异常(exception)是文本区域似乎有一个硬性的最小高度/最小宽度设置,即使使用 !important 限定符也无法通过自定义 css 更改。
textarea#myTextArea{min-height:0 !important;min-width:0 !important}
是否可以通过 jQuery 覆盖它?
最佳答案
这些“min-height
/min-width
”依赖于cols
和rows
属性。
例如。如果 cols
缺失或小于 1,则其默认值为 20,因此最小宽度将为 20 个字符宽度。
(参见 http://www.w3.org/TR/html5/forms.html#the-textarea-element)
您无法将 textarea
的大小调整到其初始尺寸以下这一事实被报告为错误 (https://code.google.com/p/chromium/issues/detail?id=94583) 尽管
The user agent may restrict the resizing range to something suitable, such as between the original formatted size of the element, and large enough to encompass all the element's contents.
http://www.w3.org/TR/css3-ui/#resize
不幸的是,目前似乎没有办法改变这种行为。
关于jquery - 自定义 CSS 以允许 chrome textarea 调整大小小于初始状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15146449/