HTML <th> atributo colspan

❮ Tag HTML <th>

Exemplo

Uma tabela HTML com uma célula de cabeçalho que abrange duas colunas:

<table>
  <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>

Definição e uso

O colspanatributo define o número de colunas que uma célula de cabeçalho deve abranger.


Suporte ao navegador

Attribute
colspan Yes Yes Yes Yes Yes

Nota: Apenas o Firefox suporta colspan="0", que tem um significado especial (veja abaixo na tabela "Valores de atributos").


Sintaxe

<th colspan="number">

Valores de atributo

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

❮ Tag HTML <th>