LESSON 67 OF 120

Build: a message textarea

Create a required, labelled textarea with a character limit.

Official sourceWHATWG HTML — textareaReviewed: 2026-08-26
STEP 1 · LEARN

How it works

Create a required, labelled textarea with a character limit. Semantic structure should describe meaning, not visual appearance.

Correct example
<form><label for="message">Message</label><textarea id="message" name="message" required maxlength="500"></textarea></form>

textarea provides multi-line text editing. name identifies the submitted value, required makes it mandatory, and maxlength sets a positive character limit.

Common mistake
<form><textarea name="message"></textarea></form>

The control supports multiple lines but has no label, id, required state or valid message-length limit.

STEP 2 · APPLY

Your exercise

Complete the example. Create a required, labelled textarea with a character limit.

STEP 3 · BUILD

Write and see the result

index.htmlHTML
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • The textarea has id, name and required.
  • Maxlength sets a positive limit.
  • The textarea has a connected label.
Explain the solution logic

Add the connected label, id and required, then set maxlength to a suitable positive number such as 500.