HTML Textarea — Multi-Line Text Input Reference
An HTML textarea is `<textarea>` — a multi-line text input. Unlike `<input>`, it has no `type` attribute (it's its own element). Configurable rows, max length, wrap behavior, and CSS-controlled resize.
The HTML `<textarea>` element is a multi-line text input. Unlike `<input>`, it doesn't take a `type` attribute — `<textarea>` is its own element. The visible size is controlled by the `rows` and `cols` attributes (or by CSS height/width). The text content is the textarea's value — there's no `value` attribute; the value goes between the opening and closing tags.
Common attributes: `rows` (visible row count), `cols` (visible columns — usually ignored in favor of CSS width), `maxlength` (max character count, enforced natively), `required` (mandatory field), `placeholder` (hint text). The `wrap` attribute controls how line breaks are handled on submission — `soft` (default, no line breaks added) or `hard` (line breaks inserted at visible wrap points).
CSS `resize` controls whether the user can drag-resize the textarea. `resize: none` locks the size; `resize: vertical` allows vertical resizing only (recommended — horizontal resizing breaks page layout); `resize: both` is the default but rarely desirable.
Native textareas are accessible by default when paired with a `<label>`. Add a character counter for `maxlength`-restricted textareas — about 8 lines of JS that listens for `input` events and updates a `<span>` with `textarea.value.length / maxlength`. Don't write a custom textarea component; native is fine.
How to set this up
Use <textarea>, not <input type="textarea">
There's no input type=textarea — it's its own element. <textarea name="x" rows="5"></textarea>.
Set rows for visible size
rows="4" is a comfortable default. Use CSS height for finer control.
Lock horizontal resize
resize: vertical (or resize: none). Horizontal resize breaks page layout.
Add maxlength for char limits
maxlength="500" enforces the cap natively. Add a counter via 8 lines of JS for UX feedback.
<textarea>, not <input type=textarea>. Lock horizontal resize. Maxlength for caps.
Frequently asked questions
What is the correct HTML for making a text area?
<textarea name="x" rows="5"></textarea>. The textarea element is multi-line text input. It's NOT <input type="textarea"> — that doesn't exist.
How do I set the size of a textarea?
Use the `rows` attribute (number of visible rows) and CSS `height` / `width` for fine control. Avoid `cols` — use CSS width instead since it's more predictable across font sizes.
How do I disable resizing on a textarea?
CSS: `resize: none`. Or restrict to vertical-only with `resize: vertical`. The default `resize: both` is rarely desirable — horizontal resize breaks page layout.
How do I limit textarea length in HTML?
Add the `maxlength` attribute. The browser enforces the limit natively — users can't type beyond it. Add a character counter via JS for UX feedback: `textarea.value.length / maxlength`.
How do I add a placeholder to a textarea?
Use the `placeholder` attribute, same as on <input>: `<textarea placeholder="Your message…"></textarea>`. The placeholder disappears when the user starts typing. Don't use placeholder as a label — visible <label> elements are accessible; placeholders alone are not.
Related guides
Ship the form, not the backend.
Free for 1,000 submissions/month. Email delivery, AI spam filtering, signed webhooks, real dashboard — all on the free plan. No credit card.
Get a free access key →