HTML <th> colspan Atribut

❮ HTML tag <th>

Příklad

HTML tabulka s buňkou záhlaví, která zahrnuje dva sloupce:

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

Definice a použití

Atribut colspandefinuje počet sloupců, které by měla buňka záhlaví obsahovat.


Podpora prohlížeče

Attribute
colspan Yes Yes Yes Yes Yes

Poznámka: Pouze Firefox podporuje colspan="0", což má zvláštní význam (podívejte se níže v tabulce "Hodnoty atributů").


Syntax

<th colspan="number">

Hodnoty atributů

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)

❮ HTML tag <th>