HTML <th> rowspan - Attribut
Beispiel
Eine HTML-Tabelle mit einer Kopfzelle, die sich über drei Zeilen erstreckt:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
<th rowspan="3">Savings for holiday!</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
Weitere „Probieren Sie es selbst“-Beispiele weiter unten.
Definition und Verwendung
Das rowspan
Attribut definiert die Anzahl der Zeilen, die eine Kopfzelle umfassen soll.
Browser-Unterstützung
Attribute | |||||
---|---|---|---|---|---|
rowspan | Yes | Yes | Yes | Yes | Yes |
Syntax
<th rowspan="number">
Attributwerte
Value | Description |
---|---|
number | Sets the number of rows a header cell should span. Note: rowspan="0" tells the browser to span the cell to the last row of the table section (thead, tbody, or tfoot) |
Mehr Beispiele
Beispiel
Verwenden von rowspan="0" (funktioniert in Chrome, Firefox und Opera):
<table>
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
<th rowspan="3">Savings for holiday!</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
<td rowspan="0">$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
❮ HTML <th>-Tag