![]() |
The majority of tables you create will probably have the same number of cells in each row, but sometimes you may need to format a table so it has a cell that spans multiple rows or columns. The is done by using either the colspan or rowspan attributes in the <td> tag to specify the number of rows or columns to be spanned. Here is an example that shows both. Color has been added to indicate which table elements are affected by the formattin.
| This HTML... | Produces this... | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
<table border=1>
<tr> <td rowspan=2>Item</td> <td align=center colspan=2>Price</td> </tr> <tr> <td>Wholesale</td> <td>Retail</td> </tr> <tr> <td>Widget</td> <td>$5.49</td> <td>$6.99</td> </tr> <tr> <td>Doodad</td> <td>$7.25</td> <td>$8.59</td> </tr> </table> |
|
|||||||||||