HTML5 <textarea> Tag


A simple textarea:

<textarea rows="2" cols="20">
At QcTutorials you can find most of the tutorials you need, from basic HTML to advanced XML, SQL, ASP, and PHP.
Code it Online »

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 HTML5

HTML5 has some new attributes: autofocus, form, maxlength, placeholder, required, and wrap.


Attribute Value Description
autofocus autofocus Makes the text area 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
dirname fieldname Specifies the name of an input field containing the text direction of the text area
form formname Defines one ore more forms the text area belongs to
maxlength number Defines the maximum number of characters allowed in the text area
name name Specifies a name for the text area
placeholder text Defines a hint to help users fill out the text area
readonly readonly Indicates that the user cannot modify the content in the text area
required required Defines if the text area value is required in order to submit the form.
rows number Specifies the number of rows visible in the text area
wrap hard
Specifies how the text in the text area is wrapped, and if it should be wrapped when submitted in a form

Standard Attributes

The <textarea> tag also supports the Standard Attributes in HTML5.

Event Attributes

The <textarea> tag also supports the Event Attributes in HTML5.

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!