English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <textarea> element represents a multi-line plain text editing control. Both the start and end tags cannot be omitted.
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 ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the <textarea> tag.
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.
HTML5 Added some new properties.
New: HTML5 new attributes.
Attribute | Value | Description |
---|---|---|
autofocusHTML5 | autofocus | Specifies that the text area automatically receives focus when the page is loaded. |
cols | number | Specifies the visible width of the text area. |
disabled | disabled | Specifies that the text area is disabled. |
formHTML5 | form_id | Defines one or more forms that the text area belongs to. |
maxlengthHTML5 | number | Specifies the maximum number of characters allowed in the text area. |
name | text | Specifies the name of the text area. |
placeholderHTML5 | text | Specifies a short hint that describes the expected value for the text area. |
readonly | readonly | Specifies that the text area is read-only. |
requiredHTML5 | required | Specifies that the text area is required./Required. |
rows | number | Specifies the number of visible lines in the text area. |
wrapHTML5 | hard soft | Specifies how the text in the text area should be wrapped when the form is submitted. |
<textarea> tag supports HTML Global Attributes.
<textarea> tag supports HTML Event Attributes.
HTML DOM Reference Manual:Textarea Object