HTML 5 <textarea> Tag
Example
A simple textarea:
<textarea rows="2" cols="20">
At W3Schools you will find all the Web-building tutorials you need, from
basic HTML to advanced XML, SQL, ASP, and PHP.
</textarea> |
View it » |
Definition and Usage
The <textarea> tag defines a multi-line text input control.
A text area can hold an unlimited number of characters, and the text renders in
a fixed-width font (usually Courier).
The size of a textarea can be specified by the cols and rows attributes, or even
better; through CSS' height and width properties.
Differences Between HTML 4.01 and HTML 5
HTML 5 has some new attributes: autofocus, form, maxlength, placeholder,
required, and wrap.
Attributes
New : New in HTML 5.
Attribute |
Value |
Description |
autofocusNew |
autofocus |
Makes the textarea focused on page load. |
cols |
number |
Specifies the number of characters visible in the text-area. |
disabled |
disabled |
Disables the text-area when it is first displayed. |
formNew |
formname |
Defines one ore more forms the textarea belongs to. |
maxlengthNew |
number |
Defines the maximum number of characters allowed in the
textarea. |
name |
name of textarea |
Specifies a name for the text-area. |
placeholderNew |
text |
Defines a hint to help users fill out the textarea. |
readonly |
readonly |
Indicates that the user cannot modify the content in the textarea. |
requiredNew |
required |
Defines if the textarea's value is required in order to
submit the form. |
rows |
number |
Specifies the number of rows visible in the text-area |
wrapNew |
hard
soft |
Specifies how to wrap the textarea's content when submitted. If the value
is "hard" then line breaks are added at the "cols" attribute's
value. The value "soft" is default, and adds no line breaks. |
Standard Attributes
The <a> tag also supports the Standard Attributes in HTML 5.
Event Attributes
The <a> tag also supports the Event Attributes
in HTML 5.
|