HTML rowspan attribute
rowspan attribute allows a cell to span more than one rows. It merges two cells to span two rows.
Preview Example
Try itExample
<table border="2">
<tr>
<th rowspan="2">Name</th>
<th>way1</th>
<th>way2</th>
</tr>
<tr>
<th>Email</th>
<th>Tel</th>
</tr>
<tr>
<td>Carl</td>
<td>carl@example.com</td>
<td>1234555</td>
</tr>
<tr>
<td>Chad</td>
<td>chad@example.com</td>
<td>4552211</td>
</tr>
<tr>
<td>Adler</td>
<td>adler@example.com</td>
<td>2555245</td>
</tr>
</table>| Name | way1 | way2 |
|---|---|---|
| Tel | ||
| Carl | carl@example.com | 1234555 |
| Chad | chad@example.com | 4552211 |
| Adler | adler@example.com | 2555245 |
Attribute values
All possible values of rowspan attributeThe value of this attribute is a valid positive integer. The integer is the number of rows spanned by the cell.
The following example uses both rowspan and colspan attributes.
Preview Example
Try itExample
<table border="2">
<tr>
<th rowspan="2">Name</th>
<th colspan="2">Contacts</th>
</tr>
<tr>
<th>Email</th>
<th>Tel</th>
</tr>
<tr>
<td>Carl</td>
<td>carl@example.com</td>
<td>1234555</td>
</tr>
<tr>
<td>Chad</td>
<td>chad@example.com</td>
<td>4552211</td>
</tr>
<tr>
<td>Adler</td>
<td>adler@example.com</td>
<td>2555245</td>
</tr>
</table>colspan attribute allows a cell to span two columns. rowspan attribute allows a cell to span two rows.
Related Tags
The tags that support rowspan attribute<th> tag
-
<th> tag defines a data cell for the heading section in a table. It supports rowspan attribute.
<td> tag
-
<td> defines a data cell for the body section in a table.
The zero value indicates that the cell is to span all the remaining rows.