Table 表格
表头A | 表头B | 表头C | 表头D | 表头E |
正常 | 1 | 1 | 1 | 1 |
列合并 | colspan='n' , n为要合并单元格数,包括本身 | 3 | ||
行合并 | rowspan='n', n为要合并单元格数,包括本身 | 1 | 1 | 1 |
1 | 1 | 1 | 1 |
实现代码
<table border='2'>
<thead>
<tr>
<td>表头A</td>
<td>表头B</td>
<td>表头C</td>
<td>表头D</td>
<td>表头E</td>
</tr>
</thead>
<tbody>
<tr>
<td>正常</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>列合并</td>
<td><b>colspan</b>='n' , n为要合并单元格数,包括本身</td>
<td colspan='3'>3</td>
</tr>
<tr>
<td><b>rowspan</b>='2'行合并</td>
<td>rowspan='n' , n为要合并单元格数,包括本身</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</tbody>
</table>
Form 表单
通过设置表单的 action 属性来设置提交按钮被点击后的请求地址
通过设置表单的 method 属性来设置表单的请求方式 ( get / post )
表单提交时会以 name 为 key 传输
通过设置 Input 的 type 属性来更改 input 类型
radio 为单选框,radio 通过设置 name 属性来分组 name 相同为一组 一组只能选中一个
checkbox 为复选框,允许同组选中多个
time 用来选择时间
week 用来选择日期
range 为滑动条
number 输入框只能输入数字
email 输入框只能输入邮箱
tel 输入框只能输入手机号(需正则匹配)
reset 按钮会恢复同一个表单下所有 input 的 value
file 用来选择文件
实现代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
.control {
width: 30%;
margin-bottom: 15px;
}
.control label {
width: 130px;
display: inline-block;
margin-right: 5%;
}
.control input {
display: inline-block;
width: 60%;
}
</style>
</head>
<body>
<form>
<div class="control">
<label>type="text"</label>
<input type="text" placeholder="placeholder属性" />
</div>
<div class="control">
<label>type="time"</label>
<input type="time" />
</div>
<div class="control">
<label>type="range"</label>
<input type="range" />
</div>
<div class="control">
<label>type="file"</label>
<input type="file" />
</div>
<div class="control">
<label>type="tel"</label>
<input type="tel" />
</div>
<div class="control">
<label>type="week"</label>
<input type="week" />
</div>
<div class="control">
<label>type="email"</label>
<input type="email" />
</div>
<div class="control">
<label>type="password"</label>
<input type="password" />
</div>
<div class="control">
<label>type="radio"</label>
<input type="radio" />
</div>
<div class="control">
<label>type="checkbox"</label>
<input type="checkbox" />
</div>
<div class="control">
<label>type="number"</label>
<input type="number" />
</div>
<div class="control">
<label>type="button"</label>
<input type="button" value="提交" />
</div>
<div class="control">
<label>type="reset"</label>
<input type="reset" />
</div>
</form>
</body>
</html>