<textarea>
Anonymous contributor
Published Jan 27, 2023
Contribute to Docs
The <textarea>
element defines a box for multi-line plain-text input that is collected from the user.
Syntax
<textarea>
<!-- Content here -->
</textarea>
Attributes are optional.
Attributes
Commonly used attributes are shown in the table below:
Attribute | Data Type | Description |
---|---|---|
id |
String | Links to <label> element. |
name |
String | Name of the table. |
rows |
Integer | Define the initial rows number. |
cols |
Integer | Define the initial columns number. |
When not given, the default value is 20 for cols
and 2 for rows
.
Example
The following example demonstrates <textarea>
with several attributes defined and an associated <label>
element:
<html><head> </head><body><label for="textbox">Share your thoughts:</label><textarea id="textbox" name="textbox" rows="1" cols="30">Okay, here's the situation...</textarea></body></html>
This will display:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn HTML on Codecademy
- Career path
Front-End Engineer
Front-end engineers work closely with designers to make websites beautiful, functional, and fast.Includes 34 CoursesWith Professional CertificationBeginner Friendly115 hours - Free course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner Friendly7 hours