The rowspan attribute on a <th> tag specifies the number of rows the table header cell should occupy, i.e. span.
If set to 0, the header cell will span until the last table row.
A rowspan attribute on 2 <th> elements.
The header cells span 2 and 3 rows respectively.
Name | Anna |
---|---|
Paxton | |
Address | 124 W 7th Street | Austin | Texas, 78702 |
<style>
table.tbl { width: 350px; border-collapse: collapse; }
.tbl th { background-color:lightblue; }
.tbl th, .tbl td { border: solid 1px #777; padding: 5px; }
</style>
<table class="tbl">
<tr>
<th rowspan="2">Name</th>
<td>Anna</td>
</tr>
<tr>
<td>Paxton</td>
</tr>
<tr>
<th rowspan="3">Address</th>
<td>124 W 7th Street</td>
</tr>
<td>Austin</td>
</tr>
</tr>
<td>Texas, 78702</td>
</tr>
</table>
The rowspan attribute specifies the numbr of rows a header cell should span.
With rowspan="0"
, the header cell will span until the last row of the table.
<th rowspan="number">
Value | Description |
---|---|
number | A whole number, e.g. 3. |
Here is when rowspan support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <th>