HTML 输入换行文本而不是水平溢出 [英] HTML input wrap text instead of overflow horizontally

查看:21
本文介绍了HTML 输入换行文本而不是水平溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 input 字段,用户将在其中输入文本.当文本变得太长时,输入字段会水平延伸,而不是垂直下拉.

I have an input field, in which a user will enter text inside. When the text becomes too long, the input field extends horizontally instead of dropping down vertically.

我尝试添加此 CSS:

I tried adding this CSS:

overflow: hidden;
word-wrap: break-word;

但我没有运气.关于如何实现这一点还有其他建议吗?

but I had no luck. Any other suggestions on how to accomplish this?

推荐答案

我认为您应该使用多行输入字段作为 TextArea:

I think you should use a multiline input field as TextArea:

http://htmlhelp.com/reference/html40/forms/textarea.html

示例代码:

<textarea rows="10" cols="30"></textarea> 

这篇关于HTML 输入换行文本而不是水平溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆