HTML <table> table Tag Reference
The table HTML tag means table, and it divides content up into rows and columns.
Use it to display tabular data, never for page layout
The table HTML tag means table, and it divides content up into rows and columns.
Use it to display tabular data, never for page layout
The table tag divides content into a grid of rows and columns, with optional headers and footers.
It must contain table row <tr> and table data <td> tags.
Use the table tag for tabular data only, i.e. where the data describes a number of objects that have the same properties.
By “tabular data”, we mean that the contents of each row (or sometimes column) have a regular pattern. e.g. The first column in each row contains the date, the next one has the transaction id, the third has a value etc.
Never use tables for structuring the layout of the page, as they are semantically incorrect and also much less flexible than more generic containers, like <div>s. You can move divs around the page, float ‘em, position ‘em absolutely, stack ‘em etc. etc., and while you can do the same with table rows & cells, your markup won’t make any sense if the table contents are displayed out of sequence.
TheĀ <table> tag is valid in all current versions of HTML and xHTML, and it should always have a closing </table> tag.
Do you love our approach to crafting simple & effective web sites that just work for people?
We'd love to hear about your web strategy.
Contact one of our team today!
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Example of a simple table</td>
<td>The table has 2 columns, each one with a column header.</td>
</tr>
<tr>
<td>The first 2 rows each have 2 cells</td>
<td>One cell in each column.</td>
</tr>
</tbody>
</table>