HTML: textarea
The <textarea> element collects multi-line text such as a comment, message, or description.
What you will learn
- How to label a multi-line field
- How to set a useful initial size and length limit
- When to use textarea instead of a single-line input
Minimal example
<label for="message">Message</label>
<textarea id="message" name="message" rows="6"
maxlength="1000" required></textarea>The content between the opening and closing tags is the initial value. Use rows to provide a comfortable starting height, but let CSS handle the final responsive layout.
Common mistakes
- Do not put a placeholder where a label is needed.
- Use
inputfor a short single-line value andtextareafor text that may contain line breaks. - Validate length and content on the server; client-side attributes are not a security boundary.