Spanning Columns
Just as you can span rows, you can span columns. You use the colspan attribute in table header or table cells (see Example 4-11).
Example 4-11. Spanning columns within a table header
[View full width]
Figure 4-12 shows the results.
<table width="90%" border="1" cellspacing="5" cellpadding="5" summary="This tabledemonstrates colspan">
<caption>Demonstrating colspan</caption>
<tr>
<th colspan=2">Header (spans 2 columns)</th>
<th>Header (no span)</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
</table>
Figure 4-12. Spanning two columns with a table header.

Example 4-12. Spanning three columns
[View full width]
You can see the results in Figure 4-13.
<table width="90%" border="1" cellspacing="5" cellpadding="5" summary="This tabledemonstrates colspan">
<caption>Demonstrating colspan</caption>
<tr>
<th colspan=2">Header (spans 2 columns)</th>
<th>Header (no span)</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td colspan="3">data (spans 3 columns)</td>
</tr>
</table>
Figure 4-13. Spanning columns within a table cell.
