The textarea
tag designates a multi-line text input, often used in a form to collect user input such as comments.
The <textarea>
‘s size is set using the cols
and rows
attributes.
<label for="example">Example text area</label>
<textarea id="example" name="example" rows="8" cols="40">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ornare enim ut cursus pellentesque. Vestibulum nec porttitor dolor. Nunc molestie venenatis mauris.
</textarea>
autofocus
Designates whether the <textarea>
should automatically get focus upon page load or not.
cols
Provides the width in pixels of the <textarea>
.
dirname
Designates whether the <textarea>
text direction will be submitted or not.
disabled
Designates whether the <textarea>
should be disabled.
form
Designates the form id that the <textarea>
belongs to.
maxlength
Determines the maximum amount of characters allowed in the <textarea>
element.
name
Provides the name of the <textarea>
element. Required for the data from the <textarea>
to be submitted with the form.
placeholder
Provides a hint description of the expected value for the <textarea>
element.
readonly
Designates that the <textarea>
element is read-only.
required
Designates that the <textarea>
element must be filled out before the form will be submitted.
rows
Numerical value of the number of lines in the <textarea>
.
wrap
Designates how text in the <textarea>
should be wrapped when the form is submitted. Possible values: hard
or soft
.
User-submitted codepen.io examples of <textarea>
↴
Submit a codepen.io link that demonstrates <textarea>
: