HTML and CSS Reference
In-Depth Information
With the exception of the headers now repeated at the foot of the table, there's no
visual difference between a table that has these elements and one that doesn't, but it's
good to include them because they provide extra, useful information about the structure
of your table that can be exploited when printing or when viewing on-screen.
Be careful when using the tfoot element. Because this element may repeat itself
over several pages, it's best used as a duplication of the thead element's content (as in
the preceding example), rather than the literal conclusion of a long table, such as a final
total beneath a column of prices (which would make little sense if it appeared before the
table had been completed).
Adding even more structure: colgroup and col
If you need a table cell to span more than one row or column, you can achieve this effect
with the rowspan and colspan attributes, each of which takes a numerical value in-
dicating how many cells a particular cell should stretch across. This is all quite straight-
forward. For example, let's imagine that in addition to residing in Auckland, New Zea-
land, I have a second residence in Vermont. Adding this data to the table requires an
additional row, but rather than leaving an empty table cell next to the new place of res-
idence, I'll insert a rowspan attribute so that the cell containing my name pairs up with
both places of residence:
<td rowspan="2">Anselm Bradford</td>
<td>Paul Haine</td>
The table now renders as shown in Figure 2-9 .
Search WWH ::

Custom Search