English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML td colspan attribute

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

 HTML <td> tag

Online Example

An HTML table with a cell spanning two columns:

<table style="width:100%;" border="1">
    <tr>
      <th>Course</th>
      <th>Price</th>
    </tr>
    <tr>
      <td>PHP Basic Course</td>
      <td align="char" char="." charoff="2">450.00</td>
    </tr>
    <tr>
      <td>JAVA Programming Course</td>
      <td align="char" char="." charoff="2">880.00</td>
    </tr>
    <tr>
    <td colspan="2">Total: 1330</td>
  </tr>
</table>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the colspan attribute.

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

Definition and Usage

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

HTML 4.01 with HTML5differences

None.

Syntax

<td colspan="number">

Attribute Value

ValueDescription
number

Specify the number of columns the cell should span.

Note: colspan="0" informs the browser to span the cell across to the last column of the column group (colgroup).

 HTML <td> tag