HTML | rowspan Attribute
The rowspan attribute in HTML specifies the number of rows a cell should span. That is if a row spans two rows, it means it will take up the space of two rows in that table. It allows the single table cell to span the height of more than one cell or row. It provides the same functionality as “merge cell” in the spreadsheet program like Excel.
Usage: It can be used with <td> and <th> element in an HTML Table.
- <td>: The rowspan attribute when used with <td> tag determines the number of standard cells it should span.
Syntax:
<td rowspan = "value">table content...</td>
The value specifies the number of rows that the cell fills. The value must be a integer.
Example:<!DOCTYPE html><html><head><title>HTML rowspan Attribute</title><style>table, th, td {border: 1px solid black;border-collapse: collapse;padding: 6px;}</style></head><bodystyle="text-align:center"><h1style="color: green;">GeeksforGeeks</h1><h2>HTML rowspan Attribute</h2><table><tr><th>Name</th><th>Age</th></tr><tr><td>Ajay</td><!-- This cell will take up space ontwo rows --><tdrowspan="2">24</td></tr><tr><td>Priya</td></tr></table></body></html>chevron_rightfilter_noneOutput:

- <th>: The rowspan attribute when used with <th> tag determines the number of header cells it should span.
Syntax:<th rowspan = "value">table content...</th>
The value specifies the number of rows that the cell fills. The value must be a integer.
Example:<!DOCTYPE html><html><head><title>HTML rowspan Attribute</title><style>table, th, td {border: 1px solid black;border-collapse: collapse;padding: 6px;}</style></head><bodystyle="text-align:center"><h1style="color: green;">GeeksforGeeks</h1><h2>HTML rowspan Attribute</h2><table><tr><th>Name</th><th>Age</th><!-- This cell will take up spacein 3 rows --><throwspan="3">GeeksforGeeks</th></tr><tr><td>Arun</td><td>24</td></tr><tr><td>Priya</td><td>25</td></tr></table></body></html>chevron_rightfilter_noneOutput:

Supported Browsers: The browser supported by rowspan attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | <th> rowspan Attribute
- HTML | <td> rowspan Attribute
- HTML | DOM TableData rowSpan Property
- HTML | for Attribute
- HTML | low Attribute
- HTML | <a> rel Attribute
- HTML src attribute
- HTML | value Attribute
- HTML | dir Attribute
- HTML | <map> name Attribute
- HTML | <li> value Attribute
- HTML | <img> alt Attribute
- HTML | <bdo> dir Attribute
- HTML | min Attribute
- HTML | <img> src Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




