Table data doesn't make much sense without titles to describe what the data represents.
To add titles to rows and columns, you can use the table heading element:
The table heading element is used just like a table data element, except with a relevant title. Just like table data, a table heading must be placed within a table row.
What happened in the code above?
First, a new row was added to hold the three headings: a blank heading, a
Saturday heading, and a
Sunday heading. The blank heading creates the extra table cell necessary to align the table headings correctly over the data they correspond to.
In the second row, one table heading was added as a row title:
Note, also, the use of the
scope attribute, which can take one of two values:
row - this value makes it clear that the heading is for a row.
col - this value makes it clear that the heading is for a column.
HTML code for tables may look a little strange at first, but analyzing it piece by piece helps make the code more understandable.