HTML <td> rowspan Attribute

The rowspan attribute on a <td> tag specifies the number of rows the table data cell should span, i.e. extend.

Example

#

A rowspan attribute on a <td> element.
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>

Using rowspan

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.


Syntax

<td rowspan="number">

Values

#

Value Description
number A whole number, e.g. 3.

Browser support

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

You may also like

 Back to <td>
Guides