Adding Table Headers

A table header denotes the header of a column or row within a table.

<th></th>

To have your headers describe the column beneath them, place all the headers in a row, and place the columns that will appear underneath in subsequent rows (see Example 4-5).

Example 4-5. Table headers for table cells

<table width="90%" border="1" cellspacing="5" cellpadding="5"><tr><th>Location</th><th>Weather</th><th>Time Zone</th></tr><tr><td>Tucson, Arizona</td><td>Warm to Hot</td><td>No Daylight Savings</td></tr></table>

By default, the browser renders table headers in bold type. As you can see in Figure 4-6, the header text is centered. You can, of course, modify the header weight, color, and other styles using CSS.

Figure 4-6. Adding ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.