Table Headings

Our table has data, but without headings we don't know what the data means. That's why we use the th element (short for table header, a table header cell). It works just like td, but it holds a heading that gives meaning to the data in its column (or row). Browsers show it in bold and centered.

<table>
	<tr>
		<th>Product</th>
		<th>Price ($)</th>
	</tr>
	<tr>
		<td>Television</td>
		<td>200</td>
	</tr>
</table>

The code in the example could be displayed like this:

ProductPrice ($)
Television200

We put th elements in the first row (tr), so the first row became the heading row of the table.

Instructions

In the first row, create two heading cells (th elements): the first with the content Date and the second with the content Temperature (°F). If you can't find the ° sign on your keyboard, you can leave it out.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

4/7