CSS 弹性文本框
我的要求是这样的。 我需要一个宽度为 5px 的文本框。当我在上面输入内容时,宽度应该增加。是否可以只使用CSS而不使用js
thnx
My requirement is this.
I need a text box with a width of 5px. As I type something on it the width should be increased. Is it possible to do using CSS only without js
thnx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ATM 仅使用 CSS 是不可能实现这一点的。
要实现此目的,您必须在每次击键时检查文本字段的当前内容宽度(使用其
onKeyUp
事件),然后相应地更改文本框的宽度。ATM this is not possible with CSS only.
To achieve this you would have to check the current content width of the textfield on every keystroke in it (use the
onKeyUp
event of it) and then change the textbox' width accordingly.嗯我只知道这个..
试试吧..
hmm i only know like this one..
try it..