HTML <th> colspan - Attribut

❮ HTML <th>-Tag

Beispiel

Eine HTML-Tabelle mit einer Kopfzelle, die sich über zwei Spalten erstreckt:

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

Definition und Verwendung

Das colspanAttribut definiert die Anzahl der Spalten, die eine Kopfzelle umfassen soll.


Browser-Unterstützung

Attribute
colspan Yes Yes Yes Yes Yes

Hinweis: Nur Firefox unterstützt colspan="0", was eine besondere Bedeutung hat (siehe unten in der Tabelle "Attributwerte").


Syntax

<th colspan="number">

Attributwerte

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