HTML colspan Attribute
Example
<table>
<tr>
<th colspan="2">Heading</th>
</tr>
<tr>
<td>Table data</td>
<td>Table data</td>
</tr>
<tr>
<td>Foot data</td>
<td>Foot data</td>
</tr>
</table>
Meaning
The colspan attribute takes a numeric value that specifies how many columns wide a cell should be.
This is useful for creating tables with cells of different widths.
Standard Syntax
<element colspan="number">
Browser Support
Status
Applies to:
The colspan attribute can be used on the following element:
Attribute Values
Value | Description |
---|---|
number | Specifies the number of columns respectively that the cell is to span. |
More Examples
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>