More than you need to know about tables

More table elements

The use of the following elements is optional, but if you do use them, make sure to put them in the order given:

  • Use a table head element (tag name thead) to designate one or more rows as the header of the table.
  • Use a table foot element (tag name tfoot) to designate one or more rows as the footer of the table.
  • Use a table body element (tag name tbody) to designate one or more rows as the main section of the table.

Attributes for tables

For assistive technologies, it is best to use the scope attribute (scope, with values row, col, rowgroup, and colgroup) to specify whether the header is associated with a row, a column, or a group of rows or columns.

For a header cell or a data cell to span more than one row or column, the row span attribute (rowspan) and column span attribute (colspan) can be given values equal to the number of rows or columns to span.