Advertisement
Home Open Editor ❯

HTML <td> colspan Attribute

Example

<table>
  <tr>
    <th>Heading</th>
    <th>Heading</th>
  </tr>
  <tr>
    <td colspan="2">Table data</td>
  </tr>
  <tr>
    <td>Table data</td>
    <td>Table data</td>
  </tr>
</table>

Try this code ❯

Meaning

The colspan attribute takes a numeric value that indicates how many columns wide a cell should be.

This is useful for creating tables with cells of different widths.


Standard Syntax

<td colspan="number">...</td>


Advertisement

Attribute Values

Value Description
number Specifies the number of columns respectively that the cell is to span.
Home Open Editor ❯
Advertisement