HTML5 <table> Tag

Example

A simple HTML table, containing two columns and two rows:

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

Try it yourself »

Definition and Usage

The <table> tag defines an HTML table.

A simple HTML table consists of the table element and one or more tr, th, and td elements.

The tr element defines a table row, the th element defines a table header, and the td element defines a table cell.

A more complex HTML table may also include caption, col, colgroup, thead, tfoot, and tbody elements.


Differences Between HTML 4.01 and HTML5

Only the "summary" attribute is supported in HTML5.


Tips and Notes

Note: You should try not to use the "summary" attribute. If the information in the "summary" attribute is important, you should use a table caption or add a text paragraph before and/or after the table.


Attributes

Attribute Value Description
border pixels Not supported in HTML5
cellpadding pixels Not supported in HTML5
cellspacing pixels Not supported in HTML5
frame void
above
below
hsides
lhs
rhs
vsides
box
border
Not supported in HTML5
rules none
groups
rows
cols
all
Not supported in HTML5
summary text Specifies a summary of the content of a table
width pixels
%
Not supported in HTML5

Standard Attributes

The <table> tag also supports the Standard Attributes in HTML5.


Event Attributes

The <table> tag also supports the Event Attributes in HTML5.