HTML <th> colspan Attribute

❮ HTML <th> tag

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.

Note: Its default value is 1. Values higher than 1000 will be considered as incorrect and will be set to the default value 1.


Standard Syntax

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



Browser Support




Status







Attribute Values

Value Description
number Specifies the number of columns respectively that the cell is to span.
❮ HTML <th> tag