HTML <textarea>Tag


Examples

An HTML text area:

<textarea rows="10" cols="30">
I am a text box.
</textarea>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the <textarea> tag.


Definition and Usage

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

The text area can hold an unlimited number of characters, and the text in it is rendered in a monospace font (usually Courier).

The size of a textarea can be specified using the cols and rows attributes, but a better way is to use the CSS height and width properties.


Differences between HTML 4.01 and HTML5

HTML5 added some new attributes.


Attributes

NewNew attributes in HTML5.

Attributes Value Description
autofocusNew autofocus Specifies that the textarea automatically gets focus when the page loads.
cols number Specifies the visible width of the textarea.
disabled disabled Specifies that the textarea is disabled.
formNew form_id Defines one or more forms to which the textarea belongs.
maxlengthNew number Specifies the maximum number of characters allowed in the textarea.
name text Specifies the name of the textarea.
placeholderNew text Specifies a short hint that describes the expected value of the textarea.
readonly readonly Specifies that the textarea is read-only.
requiredNew required Specifies that the textarea is required.
rows number Specifies the number of visible lines in the textarea.
wrapNew hard
soft
Specifies how text in the textarea should be wrapped when the form is submitted.


Global Attributes

The <textarea> tag supportsHTML Global Attributes。


Event Attributes

The <textarea> tag supportsHTML Event Attributes。


Related Articles

HTML DOM Reference:Textarea Object

Other Extensions