I have this text input in a form:
<input type="text" cols="40" rows="5" style="width:200px; height:50px;" name="Text1" id="Text1" value="" />
I am trying to get it to take multiple lines of input. The width and height make the box to be bigger, but the user can enter text all (s)he wants yet it fills one line only.
How do I make the input more like a textarea?
The HTML <textarea> tag is used to specify a multiline input control text area in HTML5. The <cols> and <rows> attributes specify size of a textarea.
The TEXTAREA element defines a form control for the user to enter multi-line text input.
A multiline text box control is a large text box that can display several lines of text or accept this text from user input. Text boxes are often linked to select value lookups and detailed menus. You can place a multiline text box control within a section control.
To create a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.
You need to use a textarea to get multiline handling.
<textarea name="Text1" cols="40" rows="5"></textarea>
It is possible to make a text-input multi-line by giving it the word-break: break-word;
attribute. (Only tested this in Chrome)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With