HTML rows Attribute
Description
The rows
attribute in HTML is primarily used in the context of a <textarea>
element. This attribute specifies the visible height of a text area, determining the number of lines that will be visible to the user without needing to scroll. It accepts a numerical value that represents the number of text lines. By adjusting the rows
attribute, developers can control the text area's vertical size, making it more suitable for its intended use, whether for a short comment box or a larger text editing area. For instance, setting rows="4"
makes the text area four lines tall. It's important to note that while the rows
attribute helps define the initial size of the text area, users can typically resize it in their browser unless the resizing feature is explicitly disabled with CSS.
Syntax
<textarea rows="number">
Values
- numberA number that specifies the rows of a textarea.
Applies To
The rows
attribute can be used on the following html elements.
Example
<textarea rows="10" cols="50">This is a text area with 10 rows and 50 columns.</textarea>
Browser Support
The following table will show you the current browser support for the HTML rows
Attribute.
Desktop | |||||
12 | 1 | 1 | 12.1 | 4 |
Tablets / Mobile | |||||
18 | 4 | 12.1 | 3.2 | 1 | 4.4 |
Last updated by CSSPortal on: 29th March 2024