HTML <th> colspanProperty

HTML <th> Tag

Example

The following HTML table contains a header cell that spans two columns:

<table border="1">
  <tr>
    <th colspan="2">Monthly Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the colspan attribute.

Note:Only Firefox supports colspan="0", which has a special meaning (see the "Attribute Values" table below).


Definition and Usage

The colspan attribute defines the number of columns a header cell should span.


Differences between HTML 4.01 and HTML5

None.


Syntax

<th colspan="number">

Property value

Value Description
number Specifies the number of columns a header cell should span.Note:colspan="0" tells the browser to make the cell span to the last column of the column group (colgroup).


HTML <th> Tagother extensions