To merge rows of a table in HTML, you can use the rowspan attribute in the
<td> or <th> tag. The rowspan attribute specifies the number of rows that a cell should span. Here's an example:
In this example, the first cell in the first row has a rowspan attribute of 2, which means it should span two rows. As a result, the first cell in the second row is merged with the first cell in the first row, creating a single cell that spans two rows.
You can adjust the rowspan value to merge more than two rows if needed. Note that the cells in the same column that are merged with a
rowspan attribute must not contain any content or be used in any other rows in the table to avoid misalignment of the table.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
To merge rows of a table in HTML, you can use the rowspan attribute in the <td> or <th> tag. The rowspan attribute specifies the number of rows that a cell should span. Here's an example:
In this example, the first cell in the first row has a rowspan attribute of 2, which means it should span two rows. As a result, the first cell in the second row is merged with the first cell in the first row, creating a single cell that spans two rows.
You can adjust the rowspan value to merge more than two rows if needed. Note that the cells in the same column that are merged with a rowspan attribute must not contain any content or be used in any other rows in the table to avoid misalignment of the table.
You need to use RowSpan.
RowSpan: It is used when we need to merge rows of the table.
ColSpan: It is used when we need to merge rows of the table.
Here is the code for your problem: