Textarea

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Textarea

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. True or false: <textarea> is self-closing like <input>.
A True
B False
2. Which attribute sets the visible height of a textarea in lines?
A height
B rows
3. True or false: <TEXTAREA> with capital letters is valid HTML.
A False
B True
4. How do you set the default text shown inside a textarea?
A Place the text between the opening and closing tags
B Use the value attribute
5. Which attribute sets the visible width of a textarea in character widths?
A cols
B width

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1<textarea name="msg" rows="5"> Hello world. </textarea> Acols sets the visible width in character widths — this textarea shows about 40 characters across
2<textarea name="bio" cols="40"> </textarea> B<form> <textarea name="comment" rows="4"> </textarea> </form>
3<textarea> requires opening and closing tags — default content goes between them CA multi-line text input — rows sets its height, and 'Hello world.' is pre-filled as the default text
4The name attribute on textarea identifies its value when the form is submitted D<textarea name="notes"> Your notes here. </textarea>
5<TEXTAREA name="msg">Hello</TEXTAREA> E<textarea> is not self-closing — it requires a separate closing </textarea> tag
6<textarea name="bio"/> FTag names must be lowercase — <TEXTAREA> and </TEXTAREA> should be <textarea> and </textarea>

Definitions

<textarea>

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
<________ name="msg">Hello</textarea>
2.
<textarea name="bio">Bio text</________)
3.
<textarea name="msg" ____="5">Text</textarea>
4.
<textarea name="n" ____="40">Text</textarea>
5.
<form> <________ name="bio" rows="4"> </textarea> </form>

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A <TEXTAREA name="msg">Hello</TEXTAREA>
B <input type="text" name="q">
C <button>Submit</button>
Question 2
A <form>
B <textarea name=msg>Enter text</textarea>
C <button>Submit</button>
D </form>
Question 3
A <form>
B <input type="text" name="q">
C <textarea name="body" rows=5>
D <button>Save</button>
E </form>
Question 4
A <form>
B <textarea name="bio">
C Tell us about yourself.
D <textarea>
E </form>
Question 5
A <form>
B <textarea name="a">One</textarea>
C <textarea name="b">Two</textarea>
D <textarea name="c">Three</textarea>
E <Textarea name="d">Four</Textarea>
F </form>

Answer Key

Textarea
Section A: Quick Questions
Q1
B — False
Q2
B — rows
Q3
A — False
Q4
A — Place the text between the opening and closing tags
Q5
A — cols
Section B: Match the Pairs
Q1
<textarea name="msg" rows="5"> Hello world. </textarea> → A multi-line text input — rows sets its height, and 'Hello world.' is pre-filled as the default text
Q2
<textarea name="bio" cols="40"> </textarea> → cols sets the visible width in character widths — this textarea shows about 40 characters across
Q3
<textarea> requires opening and closing tags — default content goes between them → <textarea name="notes"> Your notes here. </textarea>
Q4
The name attribute on textarea identifies its value when the form is submitted → <form> <textarea name="comment" rows="4"> </textarea> </form>
Q5
<TEXTAREA name="msg">Hello</TEXTAREA> → Tag names must be lowercase — <TEXTAREA> and </TEXTAREA> should be <textarea> and </textarea>
Q6
<textarea name="bio"/> → <textarea> is not self-closing — it requires a separate closing </textarea> tag
Section C: Definitions
Q1
<textarea> — An HTML element that creates a multi-line text input. Unlike <input>, it requires opening and closing tags. Default content goes between them.
Section D: Fill in the Blanks
Q1
<textarea name="msg">Hello</textarea>
Q2
<textarea name="bio">Bio text</textarea>
Q3
<textarea name="msg" rows="5">Text</textarea>
Q4
<textarea name="n" cols="40">Text</textarea>
Q5
<form> <textarea name="bio" rows="4"> </textarea> </form>
Section E: Spot the Error
Q1
A — HTML tag names must be lowercase. <TEXTAREA> and </TEXTAREA> should be <textarea> and </textarea>.
Q2
B — The name attribute value must be in double quotes: name="msg", not name=msg without quotes.
Q3
C — The rows attribute value must be in double quotes: rows="5", not rows=5 without quotes.
Q4
D — The closing tag is missing its forward slash. It should be </textarea> not <textarea>.
Q5
E — HTML tag names must be lowercase. <Textarea> and </Textarea> should be <textarea> and </textarea>.