The <textarea> tag

<textarea> creates a field for entering multi-line text — unlike input, which is single-line.

Syntax

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

Attributes

rows / cols The visible height (in lines) and width (in characters) of the field. The actual size can also be controlled with CSS.
maxlength The maximum number of characters.
placeholder A hint shown inside the field that disappears on input.

Example

<label for="msg">Message</label>
<textarea id="msg" name="msg" rows="4" placeholder="Your message..."></textarea>

Notes

  • Unlike input, textarea's initial content is written BETWEEN the tags, not in a value attribute.

Accessibility

  • Needs an associated label just like input/select.

Related tools