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.

Similar Reads

HTML | &lt;textarea&gt; rows Attribute
The HTML textarea rows Attribute is used to specify the number of visible text lines for the control i.e the number of rows to display. It also specifies the visible height of the Textarea. Syntax: &lt;textarea rows = "value"&gt; Attribute Values: number: It specify the height of the Textarea. Its Default value is 2. Example: C/C++ Code &amp;lt;!DO
1 min read
What is the use of cols Attribute in &lt;textarea&gt; Tags ?
The "cols" attribute in &lt;textarea&gt; Tags are used to specify the visible width of the "textarea" element in terms of columns. It determines the initial width of the textarea box, indicating the number of characters that can be displayed horizontally within the textarea. Syntax&lt;textarea cols="number_of_columns"&gt;&lt;/textarea&gt;number_of_
2 min read
HTML | DOM Textarea rows Property
The DOM Textarea rows Property is used to set or return the value of a rows attribute of a textarea field. The rows attribute specifies the number of visible text lines for the control i.e the number of rows to display. Syntax: It is used to Return the rows property:textareaObject.rowsIt is used to Set the rows property:textareaObject.rows = number
2 min read
HTML &lt;textarea&gt; disabled Attribute
The disabled attribute for &lt;textarea&gt; element in HTML is used to specify that the text area element is disabled. A disabled text area is un-clickable and unusable. It is a boolean attribute. Syntax: &lt;textarea disabled&gt;text content...&lt;/textarea&gt; Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head
1 min read
HTML | &lt;textarea&gt; placeholder Attribute
The &lt;textarea&gt; placeholder attribute in HTML is used to specify the expected value to be displayed before user input in textarea element. Syntax: &lt;textarea placeholder="text"&gt; Attribute Value: This attribute contains single value text which is the initial string to be displayed before user input. Example 1: This example uses &lt;textare
2 min read
HTML &lt;textarea&gt; autofocus Attribute
The HTML &lt;textarea&gt; autofocus Attribute is used to specify that the textarea field should get automatically focus when the page loads. It is a Boolean Attribute. Syntax: &lt;textarea autofocus&gt; Example: This Example illustrates the use of autofocus attribute in Textarea Element. C/C++ Code &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;
1 min read
HTML | &lt;textarea&gt; cols Attribute
The HTML &lt;textarea&gt; cols Attribute is used to tell the browser how many average-width characters should fit on a single line i.e the number of columns to display. It is used to specify the visible width of the &lt;Textarea&gt; Element. Syntax: &lt;textarea cols="number"&gt; Attribute Values: It contains the value i.e number which specifies th
1 min read
HTML | &lt;textarea&gt; required Attribute
The HTML &lt;textarea&gt; required Attribute is a Boolean attribute which is used to specify that the &lt;textarea&gt; element must be filled out before submitting the Form. Syntax: &lt;textarea required&gt; Example: This Example illustrates the use of required attribute in Textarea Element. C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html
1 min read
HTML | &lt;textarea&gt; wrap Attribute
The HTML textarea wrap Attribute is used to specify that in which manner the text is to be wrapped in a text area when a form is submitted. Syntax: &lt;textarea wrap="soft|hard"&gt; Attribute Values: soft: It specifies that the Text present in the Textarea would not be wrapped after submitting the form. This is the default value.Hard: It specifies
1 min read
HTML | &lt;textarea&gt; name Attribute
The HTML &lt;textarea&gt; name Attribute is used to specify a name of the &lt;Textarea&gt; Element. It is used to reference the form-data after submitting the form or to reference the element in a JavaScript. Syntax: &lt;Textarea name="text"&gt; Attribute Values: It contains the value i.e name which specify the name for the &lt;Textarea&gt; element
1 min read