HTML Tables

What are Tables?

HTML tables are used to display data in rows and columns.

Example

<table border="1">
  <tr>
    <th>Name</th>
    <th>Age</th>
    <th>City</th>
  </tr>
  <tr>
    <td>Rahul</td>
    <td>25</td>
    <td>Delhi</td>
  </tr>
  <tr>
    <td>Amit</td>
    <td>30</td>
    <td>Lucknow</td>
  </tr>
</table>
Try it Yourself

<table>

Table container

<tr>

Table row

<td>

Table data cell

Preview

Name Age City
Rahul 25 Delhi
Amit 30 Lucknow

Summary

  • Tables show data in rows and columns
  • <tr> creates rows
  • <td> creates cells
  • <th> creates headings