HTML and CSS Reference
In-Depth Information
</tr>
<tr>
<th scope="row">Grappling Hooks</th>
<td>27</td>
</tr>
<tr>
<th scope="row">Smoke Pellets</th>
<td>623</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Totals</th>
<td>659</td>
</tr>
</tfoot>
</table>
Figure 7-9 shows the browser output of the code in Listing 7-20 using only the browser's default styling.
Figure 7-9.
Browser output of a table with a caption
In most browsers, the
caption
element appears above its table and with center-aligned text. Placement of
the
caption
element can be adjusted in CSS using the
caption-side
property and we'll show you
examples of this in the section on styling tables later in this chapter.
While the
caption
element is optional, we strongly recommended that you include one for accessibility
purposes and as a general best practice. You can sometimes get away with omitting the
caption
element
if the table is introduced in the content with an
h1
-
h6
heading or in a preceding paragraph.