HTML <th> colspan - kenmerk

❮ HTML <th>-tag

Voorbeeld

Een HTML-tabel met een koptekstcel die twee kolommen omspant:

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

Definitie en gebruik

Het colspanattribuut definieert het aantal kolommen dat een kopcel moet beslaan.


Browserondersteuning

Attribute
colspan Yes Yes Yes Yes Yes

Opmerking: alleen Firefox ondersteunt colspan="0", wat een speciale betekenis heeft (kijk hieronder in de tabel "Kenmerkwaarden").


Syntaxis

<th colspan="number">

Attribuutwaarden

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