HTML & CSS Course
HTML & CSS
/
Beginner

Textarea

Definition

The `<textarea>` element represents a multi-line plain-text editing control.

Explain Like I'm New

An `<input type="text">` is a single-line box, perfect for names or emails. A `<textarea>` is a massive, multi-line box, perfect for comments, essays, or messages.

Real World Example

The comment box on YouTube or the 'Message' field on a Contact Us page.

Common Use Cases

  • •Collecting long-form text input

Interactive Example

Interview Questions

basic

  • Is `<textarea>` a self-closing tag like `<input>`?

intermediate

  • How do you control the initial size of a textarea?

Flash Cards

Question

Is it self-closing?

Click to reveal answer
Answer

No! It has an opening and a closing tag (`<textarea></textarea>`). Any text you put BETWEEN the tags becomes the default value.

Question

How to control size?

Click to reveal answer
Answer

You can use CSS (`width` and `height`), or you can use the native HTML attributes `rows` (number of text lines visible) and `cols` (width in characters).