今天给大家带来的是用HTML5编码表单
首先我们要了解到HTML表单是{用于搜集不同类型的用户输入},用<form>元素来定义HTML表单,
其中【<input>元素是最重要的表单元素】,其中需要根据(不同的type属性定义不同的效果)。比如:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form>
<input type="text">账号(这里直接输入内容)<br> (text为常规文本输入)
<input type="radio" name="a" checked="checked"/>是(radio,单选按钮,使用同样的name=""实现;
value="" checked,定义为默认)
<input type="radio" name="a"/>否
</form>
</body>
</html>
<br> |其中:
| <input type="submit" (定义提交按钮)
| <input type="reset" (重置))
| <input type="password"> 定义密码字段:
==定义为换行== password 字段中的字符会被做掩码处理(显示为小圆点或星号)
效果如下:
其次, select 元素定义下拉列表;option元素定义待选择的选项。
<!DOCTYPE html> | 补充:
<html> | 这里你可以设置下选择框的宽度和高度
<head> | 列表通常会把首个选项默认为被选选项
<meta charset="UTF-8"> | 能够通过添加 <option selected="selected">b</option>
<title>Document</title> | 属性来定义预定义选项
</head> | <input type="checkbox"> 定义复选框
<body> | <input type="date"> 用于应该包含日期的输入字段
<select style="width: 100px;height: 20px;"> | 注释:Firefox 或者 Internet Explorer 11 以及更早版本不支持 type="date"。
<option>a</option> | 并且有些浏览器不支持date的滑动
<option>b</option> |
<option>c</option> |
<option>d</option> |
</select><br> |
a<input type="checkbox"> |
b</b><input type="checkbox"> |
c<input type="checkbox"> |
</body> |
</html> |
ok,完毕,谢谢!