Most elegant way to force a TEXTAREA element to line-wrap, *regardless* of whitespace

前端 未结 7 1027
深忆病人
深忆病人 2020-12-14 17:18

Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I\'m looking for a wa

相关标签:
7条回答
  • 2020-12-14 18:20

    The most elegant way is to use wrap="soft" for wrapping entire words or wrap="hard" for wrapping by character or wrap="off" for not wrapping at all though the last one wrap="off" is often not needed as automatically the browser uses automatically as if it was wrap="off".
    EXAMPLE:

    <textarea name="tbox" cols="24" rows="4" wrap="soft"></textarea>
    
    0 讨论(0)
提交回复
热议问题