I would like to wrap some text in <input>
tag. When I use word-wrap: break-word
, its doesn't work.
Asked
Active
Viewed 4,360 times
-4

andreas
- 16,357
- 12
- 72
- 76

Eduard Arevshatyan
- 648
- 3
- 18
- 34
-
You mean Placeholder? Did you hear about textarea? – Abhishek Pandey Nov 03 '16 at 07:22
-
Why not using a ` – andreas Nov 03 '16 at 07:23
-
@andreas because my task is doing wrap with `` tag – Eduard Arevshatyan Nov 03 '16 at 07:25
-
It does not allow line breaks... https://html.spec.whatwg.org/multipage/forms.html#attr-input-type-text-keyword – AA2992 Nov 03 '16 at 07:26
1 Answers
2
Due to the specification, it's not possible to break lines in an input field:
Text with no line breaks
Instead you will have to use a <textarea>
(because it is the text input element that is made for line breaks), e.g.:
<textarea rows="10" cols="30"></textarea>

andreas
- 16,357
- 12
- 72
- 76
-
Probably better to reference the official spec: https://www.w3.org/TR/html5/forms.html#the-input-element – Tieson T. Nov 03 '16 at 07:30
-