HTML <textarea> tag


<textarea rows="3" cols="20">

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

All browsers support <textarea> tag.

Definition and Usage

<Textarea> tag defines a multi-line text input control.

Text area can hold an unlimited amount of text, the default font in which the text is monospaced font (usually Courier).

It can be predetermined by the size of the textarea cols and rows attributes, but a better approach is to use the CSS height and width attributes.

Note: In the text input area between lines of text, with the "% OD% OA" (carriage return / line feed) are separated.

Tip: You can set the text input area via the wrap attribute <textarea> tag wrap mode. For more information about the wrap property .

Differences between HTML and XHTML



New: HTML5 new property.

Attributes value description
autofocus autofocus The provisions of the text area in focus automatically when the page loads.
cols number Visible width specified text area.
disabled disabled Provision disable the text area.
form form_id A prescribed text area belongs to one or more forms.
maxlength number It specifies the maximum number of characters in the text area.
name name_of_textarea It specifies the name of the text area.
placeholder text Short description of the provisions of the text area prompted the expected values.
readonly readonly Provisions of the text area is read-only.
required required Provisions of the text area is required.
rows number Predetermined number of lines of text visible region.
  • hard
  • soft
When submitting the form prescribed in the text area of ​​how the text wrap. .

Global Properties

<textarea> tag supports HTML in the global properties .

Event Properties

<textarea> tag supports HTML in the event properties .