Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple lines of input in <input type="text" />

Tags:

html

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?

like image 921
Beginner Avatar asked Jun 07 '11 08:06

Beginner


People also ask

Which is used for multi line text input control?

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.

Which of the following element allows multi line text input?

The TEXTAREA element defines a form control for the user to enter multi-line text input.

What is multiline textbox?

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.

How do you input text into multiple lines?

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.


2 Answers

You need to use a textarea to get multiline handling.

<textarea name="Text1" cols="40" rows="5"></textarea>
like image 188
Ólafur Waage Avatar answered Sep 21 '22 12:09

Ólafur Waage


It is possible to make a text-input multi-line by giving it the word-break: break-word; attribute. (Only tested this in Chrome)

like image 27
Sté Avatar answered Sep 21 '22 12:09

Sté