Skip to: content, navigation

by Ian Lloyd

rowspan (HTML attribute)

Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Partial Full Partial Full
Spec
Depr. Version
No HTML 3.2
rowspan="number (of rows spanned)"

Example

An extract from a calendar, with availability showing half the day free, half busy (see figure):

  <tr>
	<th>Evening</th>
	<td rowspan="2">Free</td>
	<td rowspan="2">Busy</td>
  </tr>

Description

Where information may be relevant to multiple rows in the table, the cell containing that information can be set to span these rows using the rowspan attribute. In the colspan example for this element, we saw a calendar showing someone’s work availability with the days running along the x axis and time slots running down the y axis. This table could be turned through 90 degrees and convey exactly the same information, only now the availability spans rows rather than columns. Compare the HTML example with #rowspan/fig-th-rowspan.

Figure 1. Rowspans applied to several cells in this table showing someone’s availability for work. Rowspans applied to several cells in this table showing someone’s availability for work.

Care must be taken when introducing a rowspan attribute that everything adds up to same amount of rows taken up by the respective cells. Some tables, however, can get quite complicated with a mixture of colspan and rowspan attributes, and this is not something that you are advised to hand-code, as it is asking for trouble - it is much better to use a WYSISWYG editor, such as Dreamweaver, MS Expression or similar, which will allow you to merge and unmerge cells very easily and will take care of these attributes for you.

Value

A number which should equal the amount of rows that the spanned td cell needs to cover. There is also a special value of "0", which should inform the browser to span the cell to the end of all rows inside the current rowgroup (thead, tfoot or tbody).

Compatibility

IE5.5Partial
6.0Partial
7.0Partial
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Partial
2.0Partial
3.0Partial
Opera9.2Full
9.5Full

Browser support for rowspan is generally good, with one exception - rendering rowspan=”0”. Firefox and Opera were the only browsers tested that correctly spanned the cell to which this applied across all subsequent rows, while the other browsers tested rendered the cell in only the first row.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters