Tag
Defines a header cell in a table and may be used as a child of the element.
display: table-cell;
Attributes
-
abbr A short, abbreviated description of the header cell’s content provided as an alternative label to use for the header cell when referencing the cell in other contexts. Some user-agents, such as screen readers, may present this description before the content itself.
-
colspan A non-negative integer value indicating how many columns the header cell spans or extends. The default value is 1. User agents dismiss values higher than 1000 as incorrect, defaulting such values to 1.
-
headers A list of space-separated strings corresponding to the id attributes of the elements that provide the headers for this header cell.
-
rowspan A non-negative integer value indicating how many rows the header cell spans or extends. The default value is 1; if its value is set to 0, the header cell will extend to the end of the table grouping section (, , , even if implicitly defined), that the belongs to. Values higher than 65534 are clipped at 65534.
-
scope Defines the cells that the header (defined in the ) element relates to. Possible enumerated values are: row: the header relates to all cells of the row it belongs to; col: the header relates to all cells of the column it belongs to; rowgroup: the header belongs to a rowgroup and relates to all of its cells; colgroup: the header belongs to a colgroup and relates to all of its cells.
If the scope attribute is not specified, or its value is not row, col, rowgroup, or colgroup, then browsers automatically select the set of cells to which the header cell applies.
Examples
<table>
<tr>
<th scope="col">Symbol</th>
<th scope="col">Code word</th>
<th scope="col">Pronunciation</th>
</tr>
<tr>
<th scope="row">A</th>
<td>Alfa</td>
<td>AL fah</td>
</tr>
<tr>
<th scope="row">B</th>
<td>Bravo</td>
<td>BRAH voh</td>
</tr>
<tr>
<th scope="row">C</th>
<td>Charlie</td>
<td>CHAR lee</td>
</tr>
<tr>
<th scope="row">D</th>
<td>Delta</td>
<td>DELL tah</td>
</tr>
</table>
<table>
<tr>
<th scope="col" rowspan="2">Symbol</th>
<th scope="col" rowspan="2">Code word</th>
<th scope="col" colspan="2">Pronunciation</th>
</tr>
<tr>
<th scope="col">IPA</th>
<th scope="col">Respelling</th>
</tr>
<tr>
<th scope="row">A</th>
<td>Alfa</td>
<td>ˈælfa</td>
<td>AL fah</td>
</tr>
<tr>
<th scope="row">B</th>
<td>Bravo</td>
<td>ˈbraːˈvo</td>
<td>BRAH voh</td>
</tr>
<tr>
<th scope="row">C</th>
<td>Charlie</td>
<td>ˈtʃɑːli</td>
<td>CHAR lee</td>
</tr>
<tr>
<th scope="row">D</th>
<td>Delta</td>
<td>ˈdeltɑ</td>
<td>DELL tah</td>
</tr>
</table>
<table>
<tr>
<th scope="col" rowspan="2">Symbol</th>
<th scope="col" rowspan="2">Code word</th>
<th scope="col" colspan="2" id="p" headers="i r">Pronunciation</th>
</tr>
<tr>
<th scope="col" id="i" headers="p">IPA</th>
<th scope="col" id="r" headers="p">Respelling</th>
</tr>
<tr>
<th scope="row">A</th>
<td>Alfa</td>
<td>ˈælfa</td>
<td>AL fah</td>
</tr>
<tr>
<th scope="row">B</th>
<td>Bravo</td>
<td>ˈbraːˈvo</td>
<td>BRAH voh</td>
</tr>
<tr>
<th scope="row">C</th>
<td>Charlie</td>
<td>ˈtʃɑːli</td>
<td>CHAR lee</td>
</tr>
<tr>
<th scope="row">D</th>
<td>Delta</td>
<td>ˈdeltɑ</td>
<td>DELL tah</td>
</tr>
</table>