Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <th> rowspan Attribute

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.

Example

#

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>

Using rowspan

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.


Syntax

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

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides