Wrapping text inside input type=“text” element HTML/CSS

后端 未结 4 827
遇见更好的自我
遇见更好的自我 2020-11-30 06:11

The HTML shown below,


is displayed in a browser like so:

4条回答
  •  甜味超标
    2020-11-30 07:06

    You can not use input for it, you need to use textarea instead. Use textarea with the wrap="soft"code and optional the rest of the attributes like this:

    
    

    Atributes: To limit the amount of text in it for example to "40" characters you can add the attribute maxlength="40" like this: To hide the scroll the style for it. if you only use overflow:scroll; or overflow:hidden; or overflow:auto; it will only take affect for one scroll bar. If you want different attributes for each scroll bar then use the attributes like this overflow:scroll; overflow-x:auto; overflow-y:hidden; in the style area: To make the textarea not resizable you can use the style with resize:none; like this: