rowspan (HTML attribute)
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.
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
| IE | 5.5 | Partial |
|---|---|---|
| 6.0 | Partial | |
| 7.0 | Partial | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Partial |
| 2.0 | Partial | |
| 3.0 | Partial | |
| Opera | 9.2 | Full |
| 9.5 | Full |
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.

