HTML <textarea> Tag


The textarea element is used to construct a multi-line text input control. The <textarea> element is frequently used in forms to capture user inputs such as comments or ratings.

A text area can contain an infinite amount of characters, and the text is shown in a fixed-width font (usually Courier). 
The cols and rows characteristics define the size of a text area (or with CSS).

After the form is submitted, the name property is required to refer to the form data (if you omit the name attribute, no data from the text area will be submitted).

To tie the text area with a label, the id property is required. For optimum accessibility standards, always include the <label> tag!

Syntax

Example

Preview

Attributes

Attribute Value Description
autofocus autofocus When the page loads, this property specifies that a text area should be given emphasis by default.
cols number The visible width of a text area is specified.
dirname textareaname Specifies how the textarea's text direction will be sent.
disabled disabled Specifies whether or not a text area should be disabled.
form form-id Specifies the form to which the text area belongs.
maxlength number Specifies the maximum amount of characters that can be entered in the text field.
name text A text area's name is specified here.
placeholder text Specifies a brief description of the intended value of a text field.
readonly readonly Declares a text region to be read-only.
required required Specifies that a text field is required and must be completed.
rows number The visible number of lines in a text area is specified by number.
wrap hard 
soft
soft Indicates how text in a text area should be wrapped when submitted in a form.

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<textarea> Yes Yes Yes Yes Yes