Français

<textarea>

Allowing long text: comment, message, bio

  • HTML
  • accessibility
  • semantics
  • forms

<textarea> — The text area

The <textarea> element creates a multi-line input field. Unlike <input type="text">, it lets the user write multiple lines of text. The rows and cols attributes define the initial size.

When to use it

You want to collect a comment, a contact message, a biography, a product description, or any text that goes beyond a single line.

What you gain

Accessibility: screen readers announce a multi-line field and read the associated label. The user knows they can write multiple lines. The maxlength attribute informs them of the character limit.

Code example

<label for="message">Your message:</label>
<textarea id="message" name="message" rows="5" cols="40" maxlength="500"
  placeholder="Write your message here..."></textarea>

Further reading