English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Usage of the <th> colspan attribute, the colspan attribute defines the number of columns the header cell should span, an online instance demonstrates how to use the <th> colspan attribute, browser compatibility, syntax definition, and detailed information about its attribute values.
The following HTML table contains a header cell spanning two columns:
<table style="width:100%" border="1"> <tr> <th colspan="2">Year Income</th> </tr> <tr> <td>2018</td> <td>$15320.00</td> </tr> <tr> <td>2019</td> <td>$18320.00</td> </tr> </table>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the colspan attribute.
Note:Only Firefox supports colspan = '0', which has a special meaning (see the 'Attribute Values' table below).
The colspan attribute defines the number of columns the header cell should span.
None.
<th colspan="number">
Value | Description |
---|---|
number | Set the number of columns the header cell should span. Note: colspan = '0' tells the browser to span the cell to the last column of the column group (colgroup) |