内容
表格
为 <table> 提供干净、极简的样式,带来一致的内边距与无框的极简观感。
| Planet | Diam. (km) | Dist. to Sun (AU) | Grav. (m/s²) |
|---|---|---|---|
| Mercury | 4,880 | 0.39 | 3.7 |
| Venus | 12,104 | 0.72 | 8.9 |
| Earth | 12,742 | 1.00 | 9.8 |
| Mars | 6,779 | 1.52 | 3.7 |
| Average | 9,126 | 0.91 | 6.5 |
查看源码
<table>
<thead>
<tr>
<th scope="col">Planet</th>
<th scope="col">Diameter (km)</th>
<th scope="col">Distance to Sun (AU)</th>
<th scope="col">Orbit (days)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Mercury</th>
<td>4,880</td>
<td>0.39</td>
<td>88</td>
</tr>
<tr>
<th scope="row">Venus</th>
<td>12,104</td>
<td>0.72</td>
<td>225</td>
</tr>
<tr>
<th scope="row">Earth</th>
<td>12,742</td>
<td>1.00</td>
<td>365</td>
</tr>
<tr>
<th scope="row">Mars</th>
<td>6,779</td>
<td>1.52</td>
<td>687</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Average</th>
<td>9,126</td>
<td>0.91</td>
<td>341</td>
</tr>
</tfoot>
</table>配色方案
data-theme="light" 或 data-theme="dark" 可用于任意层级:<table>、<thead>、<tbody>、<tfoot>、<tr>、<th>、<td>。
| Planet | Diam. (km) | Dist. to Sun (AU) | Grav. (m/s²) |
|---|---|---|---|
| Mercury | 4,880 | 0.39 | 3.7 |
| Venus | 12,104 | 0.72 | 8.9 |
| Earth | 12,742 | 1.00 | 9.8 |
| Mars | 6,779 | 1.52 | 3.7 |
| Average | 9,126 | 0.91 | 6.5 |
查看源码
<table>
<thead data-theme="dark">
...
</thead>
<tbody>...</tbody>
<tfoot>...</tfoot>
</table>条纹表格
.striped 可开启斑马纹行(在无类版本中不可用)。
| Planet | Diam. (km) | Dist. to Sun (AU) | Grav. (m/s²) |
|---|---|---|---|
| Mercury | 4,880 | 0.39 | 3.7 |
| Venus | 12,104 | 0.72 | 8.9 |
| Earth | 12,742 | 1.00 | 9.8 |
| Mars | 6,779 | 1.52 | 3.7 |
| Average | 9,126 | 0.91 | 6.5 |
查看源码
<table class="striped">
...
</table>