English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete list of HTML tags

HTML: <textarea> tag

The HTML <textarea> element represents a multi-line plain text editing control. Both the start and end tags cannot be omitted.

Online example

An HTML textarea:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
</head>
<body>
<textarea name="textarea" rows="10" cols="50">Write something here</textarea>
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the <textarea> tag.

Definition and usage instructions

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

The textarea can contain an unlimited number of texts, and the default font of the text within is a monospaced font (usually Courier).

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

HTML 4.01 with HTML5differences

HTML5 Added some new properties.

Attribute

New: HTML5 new attributes.

AttributeValueDescription
autofocusHTML5autofocusSpecifies that the text area automatically receives focus when the page is loaded.
colsnumberSpecifies the visible width of the text area.
disableddisabledSpecifies that the text area is disabled.
formHTML5form_idDefines one or more forms that the text area belongs to.
maxlengthHTML5numberSpecifies the maximum number of characters allowed in the text area.
nametextSpecifies the name of the text area.
placeholderHTML5textSpecifies a short hint that describes the expected value for the text area.
readonlyreadonlySpecifies that the text area is read-only.
requiredHTML5requiredSpecifies that the text area is required./Required.
rowsnumberSpecifies the number of visible lines in the text area.
wrapHTML5hard
soft
Specifies how the text in the text area should be wrapped when the form is submitted.

Global Attributes

<textarea> tag supports HTML Global Attributes.

Event Attributes

<textarea> tag supports HTML Event Attributes.

Related Articles

HTML DOM Reference Manual:Textarea Object