forms
<textarea>
Multi-line plain-text input control. Use it for comments, messages, code snippets, or any free-form text that may span more than one line.
<textarea name="comment" rows="5" cols="40"></textarea> Common attributes
| Attribute | Purpose |
|---|---|
| name | Key submitted with the form |
| rows | Visible line count |
| cols | Visible character width |
| placeholder | Hint when empty |
| maxlength | Maximum characters allowed |
| required | Must not be empty on submit |
| wrap | soft | hard — how line breaks are submitted |
| readonly | Value is submitted but not editable |
Examples
<textarea name="bio" rows="4" maxlength="280"></textarea> Short bio with a character cap
<textarea name="code" wrap="off" spellcheck="false"></textarea> Code entry without wrapping or spellcheck
<textarea name="msg" required placeholder="Your message"></textarea> Required message field
Gotcha
Set the initial value between the tags, not with a value attribute (). Never self-close it — the closing is required.
Related tags
<input>
The single most versatile form control — its behavior is driven by the type attribute (text, email, password, number, checkbox, radio, file, date, range, color, hidden, and more). Use it for every scalar user input; use <textarea> only for multi-line text.
<form>
Container for a set of input controls that are submitted together to a server. Use it any time users need to send data — search, sign-up, checkout, comments.
<label>
Associates a caption with a form control so clicking the label focuses the input and screen readers announce it. Use one for every input, select, and textarea.
<button>
Interactive control that triggers an action — submitting a form, opening a dialog, or running JavaScript. Use it for anything that does something; use <a href> for anything that navigates.
<select>
Drop-down (or list-box) that lets the user pick one or more predefined options. Use it when the option set is short and known; for many options, an autocomplete input is friendlier.