HTML and CSS Reference
In-Depth Information
<th> Blue </th>
<td> Purple </td>
<td> Green </td>
<td> Blue </td>
Finally, add a simple caption. The <caption> element goes just after the <table> tag and
just before the first <tr> tag:
<table border=“1”>
<caption> Mixing the Primary Colors </caption>
With a first draft of the code in place, test the HTML file in your favorite browser that
supports tables. Figure 10.5 shows how it looks.
The not-quite-
perfect color
Oops! What happened with that top row? The headings are all messed up. The answer, of
course, is that you need an empty cell at the beginning of that first row to space the head-
ings out over the proper columns. HTML isn't smart enough to match it all up for you.
(This is exactly the sort of error you're going to find the first time you test your tables.)
Add an empty table heading cell to that first row. (Here, it's the line <th><br /></th> .)
<th><br /></th>
<th> Red </th>
<th> Yellow </th>
<th> Blue </th>
Search WWH ::

Custom Search