H5表单元素
本章不讲form表单,讲的是一些常用的基本表单元素
比如 input,输入框,是行内块元素
<input type="text" placeholder="请输入账号">
button,按钮,也是行内块元素 <button>按钮</button>
label,标签,用于关联一个其他表单元素,for属性需要写要关联的元素的id,点击lable就相当于点击了关联的元素<label for="psw">密码:</label>
<!-- input,type设置为password,表示密码输入框 -->
<input type="password" id="psw">
在点击“密码:”时,光标会进入input
单选多选
在使用单选多选时一定要设置name为同一组(设置相同name值)
<p>请选择你认为夺冠的队伍</p>
<!-- input,type=radio,表示单选框,处于同一组的单选框只能选中一个值,将多个radio设置相同的name属性,可以成为同一组 -->
<label for="">法国</label>
<input type="radio" name="team">
<label for="">比利时</label>
<input type="radio" name="team">
<label for="">英格兰</label>
<input type="radio" name="team">
<label for="">克罗地亚</label>
<input type="radio" name="team">
<hr>
<!-- input,type=checkbox时,表示多选框 -->
<label for="">白菜</label>
<input type="checkbox">
<label for="">苹果</label>
<input type="checkbox">
下拉列表:
<!-- select,下拉列表,行内块 -->
<label for="">请选择你的学校</label>
<select id="school">
<!-- option,下拉列表项 -->
<option value="">清华</option>
<option value="">北大</option>
<option value="">郑大</option>
</select>
梦想还是要有的(:逃