<htmlstart/>

Tables

Display data in rows and columns using HTML tables.

Basic Table Structure

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
      <th>City</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Alice</td>
      <td>28</td>
      <td>Mumbai</td>
    </tr>
    <tr>
      <td>Bob</td>
      <td>34</td>
      <td>Delhi</td>
    </tr>
  </tbody>
</table>

Table Tags

TagPurpose
<table>Container for the whole table
<thead>Header section
<tbody>Body section (data rows)
<tfoot>Footer section (totals, etc.)
<tr>Table row
<th>Header cell (bold, centered by default)
<td>Data cell
Use tables for tabular data only — not for page layout. Use CSS Grid or Flexbox for layout.
🧩

Test Yourself

4 questions
Q1.Which tag defines a table header cell?
Q2.Which tag wraps a row of table cells?
Q3.Which attribute makes a cell span multiple columns?
Q4.Which tag groups the body rows of a table?