Use the HTML textarearows attribute to specify the number of displayed lines or visible text lines of the control. Additionally, it specifies the visible height of the text area. The following is an example of setting the number of visible lines in an HTML text area. Example 1 In the following example, we are using the row properties mentioned in rows and columns.
Use the HTML textarearows attribute to specify the number of displayed lines or visible text lines of the control. Additionally, it specifies the visible height of the text area. The following is an example of setting the number of visible lines in an HTML text area. Example 1 In the following example, we are using the row properties mentioned in rows and columns.Home > Article > Web Front-end > How can we set the number of visible lines of a text area in HTML?
This article will teach you how to set the number of visible lines in a text area in HTML. The HTML
The following is the syntax for setting the number of visible lines in a text area -
<textarea rows = "value">
Use the HTML textarea rows attribute to specify the number of displayed rows or visible text rows of the control. Additionally, it specifies the visible height of the text area.
The following is an example of setting the number of visible lines in an HTML text area.
In the following example, we are using the
<!DOCTYPE html> <html> <body> <textarea rows="7" cols="25"> Doorno:11/2 kavuri hills phase2 madhapur,hyderabad telangana </textarea> <input type = "submit" value = "submit" /> </body> </html>
When the above script is executed, it will generate output consisting of the text in the textarea field, making the rows obtained by using the textarea row property visible.
In the example below, we run a script to make lines visible in a text area.
<!DOCTYPE html> <html> <body> <textarea id="mytutorial" rows="6" cols="50"> Mahendra Singh Dhoni is an Indian former professional cricketer who was captain of the Indian national cricket team in limited-overs formats from 2007 to 2017 and in Test cricket from 2008 to 2014. </textarea> <p>Click To Change Number Of Visible Rows</p> <button type="button" onclick="mytutorial1()">Click</button> <script> function mytutorial1() { document.getElementById("mytutorial").rows = "10"; } </script> </body> </html>
When you run the above script, it will generate an output that contains a textarea field filled with text along with the prompt and click button on the web page.
When the user clicks the button, this event is fired and increases the number of visible lines in the text area.
In the example below, we use the
<!DOCTYPE html> <html> <head> <title>HTML rows attribute</title> </head> <body> <form action = "/cgi-bin/hello_get.cgi" method = "get">Enter subject<br /> <textarea rows = "5" cols = "50" name = "description"></textarea><br> <input type = "submit" value = "submit" /> </form> </body> </html>
When the script is executed, it will generate an output that contains a textarea field for the user to enter the mentioned text, and a line attribute that allows the lines to be visible on the web page.
The above is the detailed content of How can we set the number of visible lines of a text area in HTML?. For more information, please follow other related articles on the PHP Chinese website!