html · level 2 · unit 2 · lesson 4
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
<textarea> gives visitors room to write.
An <input> holds one short line. For messages, reviews and special requests, use <textarea>, a that holds many lines. Unlike <input>, it has a closing tag.
rows sets how many lines tall it starts, and maxlength still limits the characters. Anything between the tags starts inside the box, so keep the tags touching for an empty one.
puts grey example words in an empty box. They vanish as soon as someone types, so they help, but never use them instead of a label.
<form>
<label for="notes">Special requests</label>
<textarea id="notes" name="notes" rows="4" maxlength="200" placeholder="For example: a window seat"></textarea>
<button>Book</button>
</form> Press show my page to see it here.
Even a few spaces between <textarea> and </textarea> end up inside the box.
guess first
What starts inside this box?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<label for="review">Your review</label>
<textarea id="review" name="review" rows="3" placeholder="What did you think?">Loved it!</textarea>
your turn
Your turn. Ask for a message.
Turn line 3 into a text area: fill in the tag name twice, make it 5 rows tall and write a placeholder of your own.
Press show my page to see it here.
- the box is a text areanot checked yet
- it starts 5 rows tallnot checked yet
- it has a placeholdernot checked yet
fix it
The button has vanished into the box. Can you fix it?
Press show my page to see it here.
- the button is backnot checked yet
- the text area starts emptynot checked yet
- The button's code shows up as words inside the box. Where does the box end?
- A text area has a closing tag. Without it, everything after becomes its words.
- Add
</textarea>straight after the>on line 3, then press run.
nailed it
your visitors have room to talk. :D
<textarea>holds many lines and needs a closing tag.rowssets its height in lines.- A placeholder is an example, never a label.
new words in your collection
- text area
- placeholder
This lesson isn’t saved. A free account remembers every lesson you finish.