colspan Attributecolspan AttributeThe colspan attribute is used on a
table cell (td
or th)
to specify the number of columns to be spanned by the cell.
For example:
<table border="1"><tbody>
<tr><td colspan="3">This cell spans three table columns</td> <td>but</td></tr>
<tr><td>each</td> <td>other cell</td> <td>spans</td> <td>only one</td></tr>
</tbody></table>
This renders as:
| This cell spans three table columns | but | ||
| each | other cell | spans | only one |
The default value is "1" and the special value of "0"
indicates that the cell should span all remaining columns, from the
current column to the last column in the current column group (defined
by a colgroup
element). If no column groups are explicitly defined, the cell should
span to the last column of the
table
itself.
Note: the special case of
colspan="0" is not very well supported
across user agents.
Although not stated officially (not that I can find, anyway) I would suggest that
any cell which spans multiple columns should not cross a colgroup boundary.
See also the rowspan attribute.