0
0
HTMLmarkup~20 mins

Textarea in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Textarea Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What will the textarea display initially?
Consider this HTML code:
<textarea>Hello
World!</textarea>

What text will appear inside the textarea when viewed in a browser?
HTML
<textarea>Hello
World!</textarea>
A
Hello
World!
BHello\nWorld!
CHello World!
D
!dlroW
olleH
Attempts:
2 left
💡 Hint
Remember that inside HTML, new lines inside textarea are rendered as line breaks.
📝 Syntax
intermediate
1:30remaining
Which textarea attribute controls the visible width?
You want to set the visible width of a textarea to 40 characters. Which attribute should you use?
Awidth="40"
Bcols="40"
Csize="40"
Dlength="40"
Attempts:
2 left
💡 Hint
Think about the standard HTML attribute for textarea width in characters.
accessibility
advanced
2:00remaining
Which option correctly associates a label with a textarea for accessibility?
You want to make sure screen readers correctly identify the textarea. Which HTML snippet correctly links the label to the textarea?
A<label name="comment">Comment:</label><textarea id="comment"></textarea>
B<label>Comment:<textarea></textarea></label>
C<textarea aria-label="Comment"></textarea>
D<label for="comment">Comment:</label><textarea id="comment"></textarea>
Attempts:
2 left
💡 Hint
The 'for' attribute on label should match the textarea's id.
layout
advanced
2:00remaining
How to make a textarea fill its container width responsively?
You want a textarea to always fill 100% of its container's width and adjust on window resize. Which CSS rule achieves this?
HTML
<textarea></textarea>
Atextarea { width: 100%; box-sizing: border-box; }
Btextarea { width: 100vw; }
Ctextarea { max-width: 100%; }
Dtextarea { width: auto; }
Attempts:
2 left
💡 Hint
Consider how padding and borders affect width and how to include them.
🧠 Conceptual
expert
2:30remaining
What happens if you set both rows and style height on a textarea?
Given this HTML:
<textarea rows="4" style="height: 200px;"></textarea>

Which statement is true about the textarea's height?
HTML
<textarea rows="4" style="height: 200px;"></textarea>
AThe browser throws an error because of conflicting height settings.
BThe rows attribute sets the height and style height is ignored.
CThe inline style height (200px) overrides the rows attribute height.
DThe textarea height is the sum of rows height plus 200px.
Attempts:
2 left
💡 Hint
CSS styles override HTML attributes when both affect the same property.