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

← All HTML tags · CSS selectors · HTML entities