HTML <td> Atribut colspan

tag <td> HTML

Contoh

Tabel HTML dengan sel tabel yang mencakup dua kolom:

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
  <tr>
    <td colspan="2">Sum: $180</td>
  </tr>
</table>

Definisi dan Penggunaan

Atribut colspanmendefinisikan jumlah kolom sel 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

<td colspan="number">

Nilai Atribut

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

tag <td> HTML