HTML input 标签的常用属性
HTML的input标签一般搭配form表单使用。
input type 属性
| text | 单行文本框 |
|---|---|
| password | 密码文本框 |
| button | 按钮 |
| reset | 重置按钮 |
| submit | 提交按钮 |
| image | 图像形式的提交按钮 |
| radio | 单选按钮 |
| checkbox | 复选框 |
| hidden | 隐藏字段 |
| file | 文件上传 |
语法: <input type="表单类型">
单行文本框
语法: <input type="text">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form name="my_Form" method="POST">
姓名:<input type="text">
</form>
</body>
</html>text 的几个重要属性
value : 定义文本框的默认值,也就是文本框内的文字
siae : 定义文本框的长度,以字符为单位
maxlength : 设置文本框中最多可以输入的字符数
placeholder : 设置文本框中提示内容
语法:
<form name="my_Form" method="POST">
姓名:<input type="text" value="zs" size="15" maxlength=""><br>
年龄:<input type="text" value="18" size="15" maxlength="3">
</form>多行文本框:
语法:
<textarea cols="行数" rows="列数">内容</textarea>实例: