HTML rowspan Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The rowspan attribute on <td> or <th> makes a cell span multiple rows vertically. Default is 1. Values above 65534 are clipped to 65534.

Omit the cells that the span already covers. Pair with colspan for horizontal merges, and use scope or headers when headers need clearer associations. Not the same as textarea rows.

Baseline · Widely available.

Not deprecated and not experimental. Standard table attribute across modern browsers.

HTML Syntax

syntax.html
<td rowspan=" number"> … </td>

Same form on <th>. In JavaScript: cell.rowSpan = 3 (capital S).

Attribute Values

How common values behave:

ValueDescriptionTry it
1 or omittedDefault — cell occupies one rowTry it
2, 3, …Cell spans that many rows; omit covered cells belowTry it
0Extends to the end of the current thead / tbody / tfoot sectionTry it
With colspanSpan both directions when the grid has free spaceTry it
> 65534Clipped to 65534 by the HTML rulesTry it

Live Preview

Change rowspan on the first-column cell. Lower rows add or omit that column so the grid stays valid.

A 3-row body. The Category cell grows downward; covered slots are left empty in markup.

table
CategoryItemQty
FruitApples4
Bananas6
DairyMilk2

rowspan="2"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Basic rowspan on td

Share one category across two item rows. Do not repeat that cell in the second row.

HTML
<table>
  <tr>
    <th scope="col">Team</th>
    <th scope="col">Player</th>
  </tr>
  <tr>
    <td rowspan="2">Blue</td>
    <td>Ada</td>
  </tr>
  <tr>
    <td>Lin</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. rowspan="2" makes Blue cover two body rows.
  2. Second player row has only one <td> — Team is already spanned.
  3. Column count still matches (Team + Player).
  4. scope="col" marks header cells for accessibility.

Example 2 — Rowspan on a header cell

Keep a corner label tall across two header rows while grouping columns with colspan.

HTML
<table>
  <tr>
    <th scope="col" rowspan="2">Product</th>
    <th scope="colgroup" colspan="2">Sales</th>
  </tr>
  <tr>
    <th scope="col">Q1</th>
    <th scope="col">Q2</th>
  </tr>
  <tr>
    <td>Keyboard</td>
    <td>120</td>
    <td>140</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. Product uses rowspan="2" across both header rows.
  2. Sales uses colspan="2" above Q1 and Q2.
  3. Second header row only lists Q1 and Q2.
  4. scope helps assistive tech map headers to data.

Example 3 — rowspan with colspan

Combine both when a cell must cover a block — keep remaining cells from overlapping.

HTML
<table>
  <tr>
    <th scope="row">A</th>
    <td>Alfa</td>
    <td rowspan="2" colspan="2">Shared block</td>
  </tr>
  <tr>
    <th scope="row">B</th>
    <td>Bravo</td>
  </tr>
  <tr>
    <th scope="row">C</th>
    <td colspan="3">Charlie — full width note</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. Shared block covers 2 columns and 2 rows from the first data row.
  2. Row B only adds left-side cells — the block already fills the rest.
  3. Row C uses colspan="3" for a full-width note.
  4. No overlaps. Count free slots before adding cells.

Edge Cases & Pitfalls

Most broken tables come from overlapping spans or mixing up rows and rowspan.

overlap

Do not overlap cells

If a cell spans two rows, omit the cell that would have sat in that column on the next row.

count

Keep column totals consistent

Each row’s cells (counting spans from above) should match the table’s column count.

zero

rowspan="0" is special

It extends to the end of the current table section (thead / tbody / tfoot), not always the whole table.

name

Not textarea rows

rows sets visible textarea height. rowspan merges table cells.

a11y

Spanned headers need care

Use scope or headers so assistive tech can still associate cells with labels.

Browser Support

rowspan is an HTML table attribute on <td> and <th>. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

rowspan

Supported everywhere modern tables work. Keep spans from overlapping for predictable layouts.

98% Global support (approx.)
Google Chrome Yes
Full support
Mozilla Firefox Yes
Full support
Apple Safari Yes
Full support
Microsoft Edge Yes
Full support
Opera Yes
Full support
Samsung Internet Yes
Full support
Internet Explorer Yes
Supported
rowspan Widely supported

Bottom line: Safe to use. Count free grid slots carefully when combining with colspan.

Key Takeaways

  • Role: span a td/th down across rows (default 1).
  • Omit covered cells in rows below the span.
  • Pair with colspan for 2D blocks when the grid allows.
  • Not textarea rows — different attribute.

One line: rowspan merges a table cell downward across multiple rows.

Frequently Asked Questions

On td or th, rowspan makes the cell span that many rows vertically. The default is 1 (a normal single row).
Only table cells: td and th. It is not the textarea rows attribute.
A non-negative integer. Default is 1. Values greater than 65534 are clipped to 65534. Special value 0 extends to the end of the current thead, tbody, or tfoot section.
rowspan merges across rows (vertical). colspan merges across columns (horizontal). You can use both on one cell when the grid allows it.
No. Do not build a table where spans cover the same grid slot. Leave out the cells that the span already covers.
Use cell.rowSpan = 3 (capital S in the DOM property) or setAttribute("rowspan", "3").

Next: rules

Learn the obsolete table rules attribute (and CSS borders instead).

rules tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful