The rows attribute in HTML is used to specify the number of visible text lines for the control i.e the number of rows to display.
Note: This attribute is only applicable on <textarea>.
Syntax
<textarea rows = "value">Text content...</textarea>Attribute Values: Its default value is 2. It contains a numeric value that specifies the height of the textarea element.
Example: In this example uses the rows attribute in a <textarea> element, setting it to display 5 rows of text. The content inside is displayed within the specified height.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>HTML rows Attribute</title>
<style>
h1,
h2 {
text-align: center;
}
</style>
</head>
<body>
<center>
<h1 style="color: green;">
GeeksforGeeks
</h1>
<h2>
HTML rows Attribute
</h2>
<!--Driver Code Ends-->
<textarea rows="5" cols="23">
This paragraph has a number of rows equal to 5.
</textarea>
<!--Driver Code Starts-->
</center>
</body>
</html>
<!--Driver Code Ends-->