HTML <textarea> rows Attribute

The rows attribute on a <textarea> tag specifies the number of lines of text, i.e. rows, that are visible in the textarea.

Example

#

A rows attribute on a <textarea> element.
The rows dictates the textarea height. A scrollbar appears because the content is larger than the number of rows allowed.

<textarea rows="5" cols="60">
Unlike most Dutch masters of the 17th century,
Rembrandt's works depict a wide range of style
and subject matter, from portraits and self-portraits
to landscapes, genre scenes, allegorical and
historical scenes, and biblical and mythological
themes as well as animal studies.
</textarea>

Using rows

The rows attribute specifies the height of the textarea, as expressed in number of lines.

If the content exceeds the number of lines, i.e. rows, a vertical scrollbar will appear.

The default value for rows is 2.

Tip: A textarea's height and width can also be specified with CSS height and width properties.


Syntax

<textarea rows="number">

Values

#

Value Description
number A number, e.g. 5.

Browser support

Here is when rows support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <textarea>
Guides