Atribut colspan HTML <th>

tag <th> HTML

Contoh

Tabel HTML dengan sel header yang mencakup dua kolom:

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

Definisi dan Penggunaan

Atribut colspanmendefinisikan jumlah kolom sel header harus span.


Dukungan Peramban

Attribute
colspan Yes Yes Yes Yes Yes

Catatan: Hanya Firefox yang mendukung colspan="0", yang memiliki arti khusus (lihat tabel "Nilai Atribut" di bawah).


Sintaksis

<th colspan="number">

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

tag <th> HTML