Description

The <textarea> tag defines a multi-line text input control within a form. The text inside the textarea usually rendered in browser's default monospace (fixed-width) font such as Courier. A text area can hold unlimited number of characters.

The following table summarizes the usages context and the version history of this tag.

Placement:Inline
Content:Text
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <textarea> tag is given with:

HTML/XHTML: <textarea cols="number" rows="number" > ... </textarea>

The example below shows the <textarea> tag in action.

<form>
    <p>Leave your Comment: 
        <textarea cols="60" rows="5">write here...</textarea>
    </p>
</form>     

Tip: You can use the <optgroup> tag for grouping related textareas within a dropdown list. It will make your forms more accessible for the users, particularly when the user have to choose from a long list of textareas.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <textarea> tag.

Global Attributes

Like all other HTML tags, the <textarea> tag supports the global attributes in HTML5.

Event Attributes

The <textarea> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<textarea>YesYesYesYesYes