HTML <textarea> rows属性实例讲解

时间:2022-04-06
本文章向大家介绍HTML <textarea> rows属性实例讲解,主要分析其语法、参数、返回值和注意事项,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

HTML textarea rows属性用于指定控件的可见文本行数,即要显示的行数。它还指定了Textarea的可见高度。

用法:

<textarea rows = "value">

属性值:


  • number:它指定Textarea的高度。其默认值为2。

例:

<!DOCTYPE html> 
<html> 
  
<head> 
    <title> 
        HTML Textarea rows Attribute 
    </title> 
</head> 
  
<body> 
    <center> 
        <h1 style="color:green;">  
            GeeksforGeeks  
        </h1> 
  
        <h2>  
            HTML Textarea rows Attribute  
        </h2> 
  
        <!-- Below textarea element has rows  
            attribute assigned to 5 -->
        <textarea rows="5" cols="23"> 
            This paragraph has number  
          of rows equal to 5. 
        </textarea> 
    </center> 
</body> 
  
</html>

输出:

支持的浏览器:下面列出了HTML textarea rows属性支持的浏览器:

  • 谷歌浏览器
  • IE浏览器
  • Firefox
  • 苹果Safari
  • Opera