HTML <th> colspan attribute
Definition and Usage
colspan
Attribute defines the number of columns the header cell should span.
Example
HTML table containing a header cell spanning two columns:
<table> <tr> <th colspan="2">Monthly Savings</th> </tr> <tr> <td>January</td> <td>¥3000</td> </tr> <tr> <td>February</td> <td>¥4000</td> </tr> </table>
Syntax
<th colspan="number">
Attribute Values
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). |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Note:Only Firefox supports colspan="0"
It has a special meaning (see the 'Attribute Values' table above).