如何获得包含水平和垂直标题的表格?
所以,例如
header1 header2 header3
header1 1 1 1
header2 2 2 2
header3 3 3 3
Run Code Online (Sandbox Code Playgroud)
all*_*arn 26
就像@UlrichSchwarz所说,你可以用<th>而不是<td>在第一列.使用范围,您可以使其更具语义描述性:
<table>
<tr>
<th></th>
<th scope="col">header1</th>
<th scope="col">header2</th>
<th scope="col">header3</th>
</tr>
<tr>
<th scope="row">header 1</th>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<th scope="row">header 2</th>
<td>2</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<th scope="row">header 3</th>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
</table>Run Code Online (Sandbox Code Playgroud)