textarea内容自动撑开高度,实现高度自适应
2023-07-17 09:50
Html/Css
164
0
0
0
标题录入
封面图
方法一: ```html <textarea rows="1" oninput="resize(this)"></textarea> <script> function resize(obj) { obj.style.height = "1px"; obj.style.height = obj.scrollHeight + "px"; } </script> ``` 方法二: ```html <textarea rows="1" oninput="resize(this)" onpropertychange="resize(this)"></textarea> <script> function resize(obj) { obj.style.height = "auto"; obj.style.height = obj.scrollHeight + "px"; } </script> ```
上一篇:
CSS 实现自动换行、强制换行、强制不换行的属性
下一篇:
html中的空格符号( nbsp; ensp; emsp; )介绍以及中文对齐实现的方法
标题录入,一次不能超过6条
发行自己的加密货币
T:0.006960s,M:244 KB
返回顶部
留言
留言
评论