HTML Tables

My reference for table structure, headers, cells, and attributes.

HTML Beginner

Table Tags

HTML table elements, their names, and their purposes.

HTML table elements, their names, and their purposes.
Tag Name Description Example
<table> Table Defines an HTML table and contains all of the table's content. <table>...</table>
<caption> Table Caption Provides a caption that identifies or describes a table. <caption>...</caption>
<thead> Table Head Groups rows containing column headings. <thead>...</thead>
<tbody> Table Body Groups the table's main data rows. <tbody>...</tbody>
<tfoot> Table Footer Groups footer or summary rows such as totals or averages. <tfoot>...</tfoot>
<tr> Table Row Creates a horizontal row of table cells. <tr>...</tr>
<th> Table Header Defines a header cell used to label a row or column. <th>...</th>
<td> Table Data Defines a standard data cell. <td>...</td>
<colgroup> Column Group Groups columns so they can share formatting or column properties. <colgroup>...</colgroup>
<col> Table Column Defines properties for one or more columns within a <colgroup>. <col span="2">

Table Attributes

HTML table attributes, their names, and how they affect table structure.

HTML table attributes, their names, and how they affect table structure.
Attribute Name Description Example
colspan Column Span Specifies how many columns a <td> or <th> spans horizontally. <td colspan="2">...</td>
rowspan Row Span Specifies how many rows a <td> or <th> spans vertically. <td rowspan="3">...</td>
scope Header Scope Identifies whether a <th> applies to a row, column, row group, or column group. <th scope="col">...</th>
headers Header Association Associates a table cell with one or more header cells by their IDs. <td headers="header1 header2">...</td>
span Column Span Specifies how many consecutive columns a <col> or <colgroup> represents. <col span="3">