Open In App

How to use the rows attribute in HTML Textarea Element ?

Last Updated : 20 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The rows attribute in <textarea> Tags are used to specify the visible height of the text area. It determines the number of visible lines of text that are initially displayed within the <textarea> element.

This attribute allows developers to control the size of the textarea box, providing users with a defined area for inputting multiline text.

Syntax

<textarea rows="number_of_rows"></textarea>

Where,

  • "number_of_rows" specifies the number of visible lines of text within the “textarea” box.

Key Point of rows Attribute

Key Point Description
Visible Height The rows attribute determines the initial visible height of the “textarea” box, specifying the number of visible lines of text.
User Interaction Users can input multiline text within the “textarea”, and the “textarea” box will expand vertically as needed to accommodate additional lines beyond the specified number of rows.

Features

  • Visible Lines: The rows attribute determines the initial visible height of the textarea box, displaying the specified number of lines of text initially.
  • User Input: Users can input multiline text within the textarea box, and the textarea will expand vertically as needed to accommodate additional lines beyond the initially specified number of rows.
  • Dynamic Sizing: The textarea box may dynamically adjust its height to fit additional lines of text beyond the initially specified number of rows, ensuring that all entered text remains visible to the user.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads