本教程原出处:网道
本教程文档在原作基础上进行了一定的补充、修改和完善,以满足个人学习、工作中的需要,亦可作为个人口袋书使用。
本教程文档中的原文部分,其版权仍归原作者所有。
本教程文档仅作个人学习、教学和工作使用,任何他人、或机构、组织不得恶意传播、复制本文档,或将本教程文档用做商用
表格标签
- 表格(table)以行(row)和列(column)的形式展示数据。
- <table>,<caption>
- <thead>、<tbody>、<tfoot>
- <colgroup>,<col>
- <tr>
- <th>,<td>
- colspan属性,rowspan属性
- headers属性
- scope属性
- scope属性只有<th>标签支持,一般不在<td>标签使用,表示该<th>单元格到底是栏的标题,还是列的标题。
<table>
<tr>
<th scope="col">姓名</th>
<th scope="col">学号</th>
<th scope="col">性别</th>
</tr>
<tr>
<th scope="row">张三</th>
<td>001</td>
<td>男</td>
</tr>
<tr>
<th scope="row">李四</th>
<td>002</td>
<td>男</td>
</tr>
</table>
- 下面是一个colgroup属性和rowgroup属性的例子。
<table>
<thead>
<tr>
<th scope="col">海报名称</th>
<th scope="col">颜色</th>
<th colspan="3" scope="colgroup">尺寸</th>
</tr>
</thead>
<tbody>
<tr>
<th rowspan="3" scope="rowgroup">Zodiac</th>
<th scope="row">Full color</th>
<td>A2</td>
<td>A3</td>
<td>A4</td>
</tr>
<tr>
<th scope="row">Black and white</th>
<td>A1</td>
<td>A2</td>
<td>A3</td>
</tr>
<tr>
<th scope="row">Sepia</th>
<td>A3</td>
<td>A4</td>
<td>A5</td>
</tr>
</tbody>
</table>