先来看一下表格的基本结构:
<table >
<thead>
<tr>
<th>学号</th>
<th>姓名</th>
</tr>
</thead>
<tbody>
<tr>
<td>1297263791</td>
<td>张三</td>
</tr>
<tr>
<td>1297263792</td>
<td>赵四</td>
</tr>
</tbody>
</table>
![](https://img.haomeiwen.com/i6543815/93cab69b795a9b6c.png)
一、常用标签
1、table标签包含整个表格
2、thead标签包含表格头部
3、表格的每一排内容使用tr标签
4、表格头部的每个单元格使用th标签
5、tbody包含表格的主体
6、表格主体的每个单元格使用td标签
二、常用类
1.table标签
1)加table类(为表格加基本样式)
![](https://img.haomeiwen.com/i6543815/64f7a96a3ca5788a.png)
2)加table table-striped类(在基本表格基础上给表格加条纹)
![](https://img.haomeiwen.com/i6543815/3f4aa91e19273cad.png)
3)加table table-bordered类(在基本表格基础上给表格加边框)
![](https://img.haomeiwen.com/i6543815/7f76b956afaecb20.png)
4)加table table-condensed类(在基本表格基础上缩小表格内边距)
![](https://img.haomeiwen.com/i6543815/72bd14a3e262aa3e.png)
以上的类还可以根据样式需要,搭配使用。
例如:加table table-striped table-bordered table-condensed 类
![](https://img.haomeiwen.com/i6543815/22bcc1ad63a76a10.png)
网友评论