rowspan

The rowspan attribute specifies the number of rows a cell should span.

Syntax

<table>
<tr>
<th>Cell 1</th>
<th>Cell 2</th>
</tr>
<tr>
<td>Cell 3</td>
<!-- Spans two rows -->
<td rowspan="2">Cell 4</td>
</tr>
<tr>
<td>Cell 5</td>
</tr>
</table>

The following elements support colspan:

  • <td>
  • <th>

Example 1

A table with a cell that spans two rows.

<table>
<tr>
<th colspan="2">Languages and Frameworks</th>
</tr>
<tr>
<td>Python</td>
<td>Django</td>
</tr>
<tr>
<td rowspan="2">JavaScript</td>
<td>React.js</td>
</tr>
<tr>
<td>Vue.js</td>
</tr>
<tr>
<td>Ruby</td>
<td>Ruby on Rails</td>
</tr>
</table>

Table with cell that spans two rows

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn HTML on Codecademy

Contributors