Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to wrap text in an input?

Tags:

html

css

No - I don't want to use a textarea.

I want to style an text input to basically look like a textarea. Thus I want it to break text instead of extend horizontally.

Why? I want to disallow line breaks in user input and I want to avoid to implement javascript which disallows return, removing line breaks from pasted content and other possible hacks.

like image 795
boop Avatar asked Feb 14 '16 01:02

boop


1 Answers

No. It is not possible to wrap text in an input as a standard feature.

If you manage to hack it, that would be invalid HTML.

HTML5 spec:

4.10.5.1.2 Text (type=text) state and Search state (type=search)

The input element represents a one line plain text edit control for the element's value.

(emphasis mine)

like image 200
Michael Benjamin Avatar answered Nov 18 '22 09:11

Michael Benjamin