<textarea>
优质
小牛编辑
139浏览
2023-12-01
描述 (Description)
HTML
例子 (Example)
<!DOCTYPE html>
<html>
<head>
<title>HTML textarea Tag</title>
</head>
<body>
<form action = "/cgi-bin/hello_get.cgi" method = "get">
Fill the Detail:
<br />
<textarea rows = "5" cols = "50" name = "description">
Enter your name
</textarea>
<input type = "submit" value = "submit" />
</form>
</body>
</html>
全局属性 (Global Attributes)
此标记支持 - HTML Attribute Reference描述的所有全局属性
具体属性 (Specific Attributes)
HTML
属性 | 值 | 描述 |
---|---|---|
自动对焦 ![]() | autofocus | 指定在页面加载时文本区域应自动获得焦点。 |
cols | number | 根据可见字符宽度的数量指定textarea的宽度。 |
disabled | disabled | 根据可见字符宽度的数量指定textarea的宽度。 |
形成 ![]() | form_id | 指定一个或多个表单。 |
最长长度 ![]() | number | 指定textarea中的最大字符数。 |
name | text | 为输入控件指定名称。 |
占位符 ![]() | text | 指定textarea中值的简短提示。 |
readonly | readonly | 将输入控件设置为只读。 它不允许用户更改值。 但是,控件可以获得焦点,并在通过表单控件进行选项卡时包含。 |
需要 ![]() | required | 指定需要textarea。 |
rows | number | 根据可见文本行数指定textarea的高度。 如果有更多文本允许,用户可以使用textarea的滚动条滚动。 |
包裹 ![]() | hardsoft | 指定要包装在textarea中的文本。 |
事件属性 (Event Attributes)
此标记支持 - HTML Events Reference描述的所有事件属性
浏览器支持 (Browser Support)
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |