Grokking HTML
Vote

0% completed

​

Adding Captions to Tables

How does a reader know what a table is about before reading its first row? A sighted reader glances at the text around it. A screen reader user who jumps from table to table, which screen readers allow, hears only "table, 4 rows, 3 columns", unless the table has a title of its own. HTML gives a table that title with the <caption> element.

Adding a caption

The <caption> element must be the first child of <table>: it comes right after the <table> start tag, before any <thead>, <tbody> or <tr>. Here is the bakery price list with a caption:

<!DOCTYPE html>

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content