What Is The HTML <textarea> Tag?

What Is The HTML Textarea Tag

Date First Published: 21st February 2023

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 6/10

Learn more about what the HTML <textarea> tag is in this article.

In HTML, the <textarea> tag is used within a form to define a multi-line plain text form field. A text area can have an unlimited number of characters and the text within this tag is often rendered in a fixed-width font. This tag is often used to define fields where users can enter and submit comments and reviews in a HTML form.

Note: Info Icon

To adjust the width and height of the text area, use CSS.

Example Of The <textarea> Tag

An example of the <textarea> tag in a HTML form with the output can be seen below:

<form> <label for="name">Name</label><br> <input type="text" id="name" name="name"><br> <textarea rows="4" cols="35" name="comment" placeholder="Comment"></textarea>

Attributes

The table below shows the attributes for the <textarea> tag.

Attribute Description
autofocus Specifies that the text area should be selected upon page loading.
cols Specifies the visible width of the text area.
disabled Specifies that the text ares should be disabled.
form Specifies the form(s) that the text area belongs to.
maxlength Specifies the maximum number of characters allowed in the textarea.
name Specifies a name for the text area.
placeholder Specifies a hint that describes the expected value of a text area. It is displayed when the text area is empty and disappears when it gets focus.
readonly Specifies that the text area should be read only.
required Specifies that the text area must be filled out.
rows Defines the height of the text area.
spellcheck Specifies whether the text in the text area should be checked for spelling by the browser or operating system.
wrap Defines how the text in a text area should be wrapped when the form is submitted.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.


Comments