1.表单类型
- 校验邮箱格式
email:<input type="email"> <br/>
- 校验url格式
url:<input type="url"> <br/>
- 数字类型 输入非数字不生效
number: <input type="number" max="10" min="0" step="2"> <br/>
range: <input type="range" max="10" min="0" step="3"> <br/>
- search类型 有一个清空内容的按钮
search: <input type="search"> <br/>
- 日期/时间类型 有年/月/日选项
date: <input type="date">
month: <input type="month">
time: <input type="time">
- 返回颜色的十六进制表示
color: <input type="color">
- 只有在手机上会生效, 显示手机拨号键盘
maxlength 输入内容的最大长度
tel: <input type="tel" maxlength="11">
- 上传文件
accept 限制文件上传的类型
file: <input type="file" accept="image/png">
2.下拉列表选择类型
- datalist型
datalist、input、opation 三者配套使用
需要配合input使用
datalist 与 option 组合使用
input设置list属性与datalist的id关联
<input type="text" list="name">
<datalist id="name">
<option value="shirley" label="18">shirley</option>
<option value="shirley" label="17">shirley</option>
<option value="cherry">cherry</option>
<option value="xiaoming">xiaoming</option>
</datalist>
- select型
shirley cherry xiaoming<select name="" id=""> <option value="shirley">shirley</option> <option value="cherry">cherry</option> <option value="xiaoming">xiaoming</option> </select>区别:datalist型 可在输入字母时显示下拉列表 并匹配包含输入字母的选项