SyntaxStudy
Sign Up
HTML Beginner 1 min read

HTML Tables

HTML Tables

Tables display data in rows and columns. Use them for tabular data — not for page layout.

Table Tags

TagPurpose
<table>Container for the whole table
<thead>Header section
<tbody>Body/data section
<tfoot>Footer section (totals, notes)
<tr>Table row
<th>Header cell (bold, centred)
<td>Data cell

Spanning

Use colspan="2" to span multiple columns, and rowspan="2" to span multiple rows.

Example
<table border="1">
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
      <th>City</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Alice</td>
      <td>25</td>
      <td>London</td>
    </tr>
    <tr>
      <td>Bob</td>
      <td>30</td>
      <td>New York</td>
    </tr>
  </tbody>
</table>