HTML Tables - Headings in Tables
(Page 2 of 7 )
So far we have used tables and created the semblance of a column header. In reality, you create column headers with the <th> tag, like so:
<html>
<body>
<table border="1">
<tr>
<th>Cool People</th>
<th>Nerds</th>
</tr>
<tr>
<td>James Payne</td>
<td>You</td>
</tr>
</table>
</body>
</html>
Which displays:
Cool People | Nerds |
|---|
James Payne | You |
Creating a Table Caption
If you want to create a caption for your table, you can do so using the <caption> tag:
<html>
<body>
<table border="2">
<caption>Hey...I'm a Caption</caption>
<tr>
<td>Red</td>
<td>Yellow</td>
<td>Blue</td>
<td>Green</td>
<td>Orange</td>
<td>Purple</td>
</tr>
</table>
</body>
</html>
Here is the table with the caption:
Hey...I'm a Caption
Red | Yellow | Blue | Green | Orange | Purple |
Next: Spanning More than One Row or Column >>
More HTML Articles
More By James Payne