jquery - 自定义 CSS 以允许 chrome textarea 调整大小小于初始状态?

标签 jquery css google-chrome resize textarea

我喜欢 Chrome 漂亮的文本区域调整大小控件。然而,一个异常(exception)是文本区域似乎有一个硬性的最小高度/最小宽度设置,即使使用 !important 限定符也无法通过自定义 css 更改。

textarea#myTextArea{min-height:0 !important;min-width:0 !important}

是否可以通过 jQuery 覆盖它?

最佳答案

这些“min-height/min-width”依赖于colsrows 属性。 例如。如果 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/

相关文章:

javascript - 如何在此 html 标记中通过 css 显示省略号

html - 具有持久纵横比的响应式 CSS 网格

jquery:幻灯片放映,当您在另一个浏览器选项卡中停留一段时间,然后返回到带有幻灯片放映的选项卡时,它会翻转出来

javascript - 使用 jQuery 向下滑动一个 div,向上滑动其他可见的 div(基于内容的滑动导航)

javascript - 在浏览器上显示之前在后端预加载/刷新页面

html - anchor 在一页站点中不起作用

php - 如何使用 PHP include 保留路径结构?

java - 如何强制 Selenium 在新窗口中打开链接?

javascript - 最新的 Chrome 更新和打印困惑了?

javascript - setTimeout、jQuery 操作、transitionend 随机执行/触发