You can separate a table into three main functional parts—a header section, one or more body sections, and a footer section. The primary purpose of the header and footer sections is to duplicate the header and footer on each page when the user prints multipage tables. For tables without borders, you can separate sections in the body of the table with horizontal lines by placing the content into multiple body sections. You may have only one header and one footer section in a table.
To define the header section, use a <thead> tag. You may have multiple rows within the header section. You can also automatically format the header cells with bold text by using table header (<th>) tags in the header section rather than table data (<td>) tags.
You may have multiple table body (<tbody>) tags in a table. Each <tbody> tag defines one section of the table body. By default, a table has a table body section even if you don't define one explicitly. The browser separates multiple table body sections with horizontal lines.
You define the footer section with the table footer (<tfoot>) tag. The footer section may contain multiple rows. There's no corresponding <tf> tag for footer sections to parallel the <th> tag for the header section. However, you may use <th> tags in the footer section in place of the <td> tags just as you would in the header section to format the footer row(s) in bold text.
Was this article helpful?