tables

<table>

Displays two-dimensional tabular data — rows and columns with meaningful relationships. Never use it for page layout; use CSS grid or flexbox for that.

<table><thead>...</thead><tbody>...</tbody></table>

Common attributes

Attribute Purpose
class Styling hook
id Anchor / JS hook
summary Deprecated in HTML5 — use <caption> instead

Examples

<table><caption>Prices</caption><thead><tr><th>Plan</th><th>Cost</th></tr></thead><tbody><tr><td>Pro</td><td>$9</td></tr></tbody></table>

Well-structured data table

<table><tr><th scope="col">Name</th><th scope="col">Age</th></tr><tr><td>Ada</td><td>36</td></tr></table>

Simple table with column-scoped headers

<table><tbody><tr><td colspan="2">Merged</td></tr></tbody></table>

Cell spanning two columns

Gotcha

Include a and use or scope="row" so screen readers can announce headers correctly. Tables are for data — using them for layout hurts accessibility and responsiveness.

← All HTML tags · CSS selectors · HTML entities