Signup/Sign In
PUBLISHED ON: FEBRUARY 22, 2021

HTML Textarea Tag

In HTML, to create a multi-line plain editing control <textarea> tag is used.

  • The <textarea> tag is useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.

  • The <textarea> tag also accepts several attributes common to form <input>s, such as autocomplete, autofocus, disabled, placeholder, readonly, and required.

  • Also, this is an Inline element.

  • To specify the size of textarea; we use cols and rows attributes of <textarea> tag.

  • It is recommended to give labels using <label> tag to a textarea.

HTML<textarea> Tag Syntax and Usage

The <textarea> element requires the start(opening) tag and end(closing) tag.

Following is the syntax for using the textarea tag in your HTML code:

<textarea>
...content here
</textarea>

HTML <textarea> Tag Attributes

The <textarea> tag supports both global and event attributes and some of the common attributes are given below.

Attributes Description
name Inside <textarea> area tag, the name attribute is used to specify the name of the control.
minlength The minimum number of characters (Unicode code points) required that the user should enter.
maxlength The Maximum number of characters (Unicode code points) required that the user should enter.
cols This attribute is used to specify the width of the textarea.
rows This attribute is used to specify the number of visible lines in a textarea
wrap This attribute indicates how the control wraps text. Possible values are: hard, soft and off
spellcheck Specifies whether the textarea is subject to spell checking by the underlying browser/OS; true, false and default are three values of spellcheck attribute
required This attribute ensures that it is a required filled or this field must be filled
readonly This attribute specifies that a given textarea is a read-only type
autofocus This attribute specifies textarea gets focus automatically whenever the web page gets loaded.
form This attribute specifies the form to which textarea belongs to

HTML <textarea> Tag Basic Example

Below we have a basic example showing how we use the HTML textarea tag.

Browser Support for HTML<textarea> Tag

Following browsers support this attribute:

  • Google Chrome 6.0+

  • Internet Explorer 9.0+

  • Firefox 4+

  • Opera 11.1+

  • Safari 5.0+



About the author:
Aspiring Software developer working as a content writer. I like computer related subjects like Computer Networks, Operating system, CAO, Database, and I am also learning Python.