Table Headings
Now that we have data in the table, but without headings, we don't know what the data represents. That's why we use the th
element (table header) to define headings that give meaning to our data.
<table>
<tr>
<th>Product</th>
<th>Price ($)</th>
</tr>
<tr>
<td>Television</td>
<td>15,000</td>
</tr>
</table>
The code in the example could be displayed as follows:
Product | Price ($) |
---|---|
Television | 200 |
We added the th
element to the first row (tr
), which created the table headings in the first row.
Instructions
In the first row, create two heading columns (using the th
element). The first column should have the content Date
and the second column should have the content Temperature (°F)
.
Start programming for free
4/7