Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

Table – HTML

Summary

Tables are used to show tabular data on a web page.

Details

Here is an example of a simple HTML table:

<table>
  <tr>
    <th>Header 1</th>
    <th>Header 2</th>
    <th>Header 3</th>
  </tr>

  <tr>
    <th>Row Header</th>
    <td>Cell 1</td>
    <td> Cell 2</td>
  </tr>

  <tr>
    <th>Row Header</th>
    <td>Cell 3</td>
    <td>Cell 4</td>
  </tr>
</table>

An HTML table is composed of the tr element for the rows, the th element for the headings, and the td element for the regular table cells. These elements are all nested inside a table element.

Demo

Exercises

Recreate the embedded CodePen demo by typing out the HTML code in your index.html file.

References

Table element – MDN

Lesson tags: Open Lesson
Back to: HTML Course > HTML Tables