HTML and CSS Reference
In-Depth Information
31. <td>$13.54</td>
32. </tr>
33. <tr>
34. <td>Total</td>
35. <td></td>
36. <td></td>
37. <td>$148.90</td>
38. </tr>
39. </tfoot>
40. </table>
Figure 11.4 A table of topics complete with caption, table head, table body, and table
foot elements
Combining Multiple Cells
Often, two or more cells need to be combined into one without breaking the overall row
and column layout. Perhaps two cells next to each other contain the same data, there's an
empty cell, or the cells should be combined for styling purposes. In these cases we can use
the colspan and rowspan attributes. These two attributes work on either the <td> or
<th> elements.
The colspan attribute is used to span a single cell across multiple columns within a table,
while the rowspan attribute is used to span a single cell across multiple rows. Each attrib-
ute accepts an integer value that indicates the number of cells to span across, with 1 being
the default value.
Using the table of topics from before, we can now remove the empty table cells within the
table footer as well as clean up the table header (see Figure 11.5 ) .
Click here to view code image
1. <table>
Search WWH ::




Custom Search