Back to course

Lesson 19: Creating Basic Data Tables (`<table>`)

The HTML Masterclass: From Zero to Web Developer

19. Creating Basic Data Tables (<table>)

Tables are used to display tabular data (not for layout, which is what CSS is for). A basic table requires three core elements.

19.1 Basic Table Structure

  1. <table>: The container for the entire table.
  2. <tr>: Table Row.
  3. <td>: Table Data Cell (standard cell).

html

Cell 1, Row 1Cell 2, Row 1
Cell 1, Row 2Cell 2, Row 2

19.2 Table Headers (<th>)

Table Header cells (<th>) are used to label the columns or rows. They are typically rendered bold and centered by default, and provide semantic meaning.

html

NameAgeCity
Alice30New York