Build a data table

Task

Create a table with three columns (Name, Price, Quantity) and three rows of data, with a properly separated header and body.

Requirements

  • The table is wrapped in <table>
  • Column headers are in <thead> using <th>
  • Data rows are in <tbody> using <td>
  • At least 3 rows of data

Starter code

<table>
</table>
▶ Open in HTML Editor

Hints

  • th is only for headers; td is for regular data cells.
  • thead and tbody don't have to look different visually, but they matter for screen readers and styling.
Show solution
<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Price</th>
      <th>Quantity</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Laptop</td>
      <td>$900</td>
      <td>3</td>
    </tr>
    <tr>
      <td>Mouse</td>
      <td>$15</td>
      <td>10</td>
    </tr>
    <tr>
      <td>Keyboard</td>
      <td>$35</td>
      <td>5</td>
    </tr>
  </tbody>
</table>

Related tools