HTML ยท Module 08 ยท Lesson 39 of 54

Textareas & Choice Datalists

What is a Textarea?

Think of writing a brief title (which needs a single line input) versus writing a long blog post comment or support request details (which need a big, scrollable box that can expand).

In HTML, the <textarea> element represents a multi-line plain-text editing control:

  • rows: Sets the default vertical height of the box in text lines.
  • cols: Sets the default horizontal width in character columns.
  • Unlike normal input fields, <textarea> is not self-closing and uses opening and closing tags.

    Why does it matter?

    Text areas are essential for text boxes where users need to write descriptions, reviews, bios, or message details that span multiple paragraphs.

    How to write it

    <textarea rows="4" cols="30"></textarea>
    

    Scrollable textarea region...

    Common Mistakes

  • Trying to set placeholder text inside a value attribute: Unlike text inputs, textarea doesn't use a value attribute. If you write <textarea value="Text"></textarea>, it will be ignored. To prefill text, place it *between* the tags: <textarea>Default text</textarea>.
  • Quick Reference

  • <textarea> โ€” Renders a multi-line text block container.
  • rows="height" and cols="width" โ€” Sets default dimensions.
  • Your Task
    Create a `<textarea>` element with attributes `rows="4"` and `cols="30"`.
    index.html
    Type code above to start the lesson.
    Live Preview