The rowspan attribute on a <td> tag specifies the number of rows the table data cell should occupy, i.e. span.
With a value of 0, the data cell will span until the last table row.
A rowspan attribute on 2 <td> elements.
The country data cells span 2 and 3 rows respectively.
Firstname | Lastname | Country |
---|---|---|
Anna | Samsong | Sweden |
Imgar | Johanson | |
Stephanie | James | USA | Karen | McNolen | Jamie | Spiro |
<style>
table.tb { width: 350px; border-collapse: collapse; }
.tb th { background-color:lightblue; }
.tb th, .tb td { border: solid 1px #777; padding: 5px; }
</style>
<table class="tb">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Country</th>
</tr>
<tr>
<td>Anna</td>
<td>Samsong</td>
<td rowspan="2">Sweden</td>
</tr>
<tr>
<td>Imgar</td>
<td>Johanson</td>
</tr>
<tr>
<td>Stephanie</td>
<td>James</td>
<td rowspan="3">USA</td>
</tr>
<td>Karen</td>
<td>McNolen</td>
</tr>
</tr>
<td>Jamie</td>
<td>Spiro</td>
</tr>
</table>
The rowspan attribute specifies the numbr of rows a data cell should span.
With rowspan="0"
, the data cell will span until the last row of the table.
<td 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 |