The HTML rows attribute
Quick answer
The HTML rows attribute sets the visible number of text lines. It is used on the <textarea> element.
Overview
The rows attribute sets the visible line count of a textarea. It is used on the <textarea> element.
It configures a <textarea> multi-line text field — its visible size and how line breaks are handled on submission.
Syntax
<textarea rows="6"></textarea>
Values
| Value |
|---|
| A positive integer (default 2). |
Example
<textarea rows="4" cols="30">Four rows tall</textarea>
Best practices
Frequently asked questions
What does the rows attribute do?
Sets the visible line count of a textarea.
How do I set the size of a textarea?
What does the wrap attribute do?
It controls whether line breaks the user sees are included in the submitted value (
soft) or not (hard adds them).Which elements use the rows attribute?
It is an element-specific attribute, used on the <textarea> element.