Skip to the page
html reference · layout

HTML <table> / <tr> / <td> tags

closing tag
required (all)
void element
no
lives inside
<body>
typically holds
<tr> rows, each holding <td>/<th> cells

Where it goes

<table> wraps everything. Each <tr> inside it is a row. Each <td> or <th> inside a <tr> is a cell.

Example

<table>
  <tr><th>Name</th><th>Age</th></tr>
  <tr><td>Ann</td><td>30</td></tr>
</table>

Open this example in the editor →

Common mistakes

  • Using a table to lay out a page. Tables are for data. Page layout is a job for CSS.
  • Using <td> for the header cells. Use <th>, so the headers mean something. Then a screen reader (software that reads the page aloud) can read them out with each value.

Related

Updated 24 October 2026. Practice it in the html route, or read more on MDN.