hello大家好,我是你的人类朋友😁!
因为俺表格中的标签总是记不住,所以决定写一篇笔记帮助自己进行记忆。不懂就翻来看看✌️。
表格的组成部分
- 表格——
<table> - 表格标题——
<caption>(caption:n.标题) - 表格头部——
<thead>(也就是table head的缩写) - 表格主体——
<tbody>(也就是table body的缩写) - 表格脚注——
<tfoot>(也就是table foot的缩写)
上代码
<table>
<!-- 表格标题 -->
<caption>
我是标题
</caption>
<!-- 表格头部 -->
<thead>
<tr>
<th>姓名</th>
<th>性别</th>
<th>年龄</th>
</tr>
</thead>
<!-- 表格主体 -->
<tbody>
<tr>
<td>张三</td>
<td>男</td>
<td>21</td>
</tr>
<tr>
<td>李四</td>
<td>女</td>
<td>22</td>
</tr>
<tr>
<td>王五</td>
<td>男</td>
<td>23</td>
</tr>
</tbody>
<!-- 表格脚注 -->
<tfoot>
<tr>
<td></td>
<td></td>
<td>共计3人</td>
</tr>
</tfoot>
</table>
tr的r代表的是row——行th的h代表的是<thead>的表格头部里面的单元格td的d代表的是data,也就是代表表格主体中的数据
效果图片如下
当然也可以加上边框,只需要在<table>标签处加上border = "1"即可
效果图如下
结尾
记起来吧👍下次见~