Tables
Tables are composed of table, captions, tbody, tr, th, and td tags. The table
is the overall table, caption tags exists outside tbody and acts very much like
the label or title for the table, tbody is the table body, tr is a row in the table,
th is a table header, and td is a table data cell. For accessibility, caption
and th tags should be used whenever semantically appropriate.
<table cellspacing="0" border="0"> <!--table start-->
<caption>Multiplication Table Example</caption> <!--table caption-->
<tbody> <!--table body start-->
<tr> <!--table row-->
<td> <!--table data(empty-ish)-->
<br>
</td>
<th role="col"> <!--column table header-->
1
</th>
<th role="col">
2
</th>
<th role="col">
3
</th>
</tr>
<tr>
<th role="row"> <!--row table header-->
1
</th>
<td> <!--table data cell with contents 1-->
1
</td>
<td>
2
</td>
<td>
3
</td>
</tr>
<tr>
<th role="row">
2
</th>
<td>
2
</td>
<td>
4
</td>
<td>
6
</td>
</tr>
<tr>
<th role="row">
3
</th>
<td>
3
</td>
<td>
6
</td>
<td>
9
</td>
</tr>
</tbody> <!--end table body-->
</table> <!--end table-->
Displays as:
|
1 | 2 | 3 |
---|---|---|---|
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |