View video tutorial

HTML rows Attribute

HTML

The HTML rows attribute is used to specify the visible height of the text area in lines in the <textarea> element.

Definition and Usage


➔ The rows attribute on the textarea element takes a positive integer value, which determines the number of lines of text that are visibly displayed without scrolling.

➔ The rows attribute takes a positive integer value

Syntax
//In HTML
<textarea rows="5" cols="50" id="sample">
    This text area will display 5 visible lines.
</textarea>

//In Javascript
let element=document.querySelector("#sample");
element.rows = 10;
//or
element.setAttribute("rows", "10");

Applies to

This attribute can be used on the following element.

Attribute Element
rows <textarea>