textarea HTML

HTML <textarea> Tag

The <textarea> tag in HTML is used to specify a multi-line input control. It allows to insertion of multiple-line text in a form. The size of this tag can also be specified, and to serve this purpose we can either use the “rows” or “cols” attribute or we can use CSS.

Example:

<!DOCTYPE html>  
<html>   
<body>  
<form>  
Message:<br><br> 
<textarea rows="5" cols="30"></textarea>  
</form>  
</body>  
</html>

Explanation:

In the above example, we created a five rows and 30 columns text area field.

Tag specific Attributes:

Attribute Value Uses
autofocus autofocus Used to indicate that a text area should automatically focus on page loading.
cols number Used to define the visible width of a text area.
dirname textareaname.dir Used to indicate that the text direction of the text area will be submitted.
disabled disabled Used to indicate that a text area should be disabled.
form form_id Used to define the form or forms to which the text area belongs.
maxlength number Used to define the maximum number of characters allowed in the text area.
name text Used to define a name for a text area.
placeholder text Used to define a short hint to specify the expected value of a text area.
readonly readonly Used to define that the text area is of read-only type.
required required Used to define that the text area is required and should be filled out.
rows number Used to define the number of lines that are visible in a text area.
wrap hard

soft

Used to determine the way in which the text in a text area is to be wrapped when submitted in a form.

Global Attributes:

The HTML Global attributes are supported by the HTML <textarea> tag.

Event Attributes:

The HTML Event attributes are supported by the HTML <textarea> tag.

Supporting Browser:

Chrome, IE, Firefox, Opera, and Safari.