Atrybut HTML <th> colspan

❮ Znacznik HTML <th>

Przykład

Tabela HTML z komórką nagłówka, która obejmuje dwie kolumny:

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

Definicja i użycie

colspanAtrybut określa liczbę kolumn, które powinna obejmować komórka nagłówka .


Obsługa przeglądarki

Attribute
colspan Yes Yes Yes Yes Yes

Uwaga: tylko Firefox obsługuje colspan="0", co ma specjalne znaczenie (spójrz poniżej w tabeli „Wartości atrybutów”).


Składnia

<th colspan="number">

Wartości atrybutów

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)

❮ Znacznik HTML <th>