How can I get my HTML table to be shown as supposed to?

2 weeks ago 20
ARTICLE AD BOX

In an HTML table, rows are created by <tr></tr>. rowspan spans rows but does not create a new rows.

<td colspan="4" rowspan="2">4x2</td>

Here, the cell has a rowspan as 2, but the row below already has values, which will be used by the table. Because of this, you get an uneven structure.
The empty row created will be occupied by the cell with rowspan="2", if you change rowspan="3" and add a single empty row, you see the changes.

Damodharan's user avatar

New contributor

Damodharan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You need to "consume" Line 3 in the code, even though it doesn't have new cells (<td>), because it exists in the grid structure.

Just add a pair of empty line tags right after the closing tag.

<tr> <td colspan="5" rowspan="5">5x5</td> <td colspan="4" rowspan="2">4x2</td> </tr> <tr></tr> <tr> <td>6</td><td>7</td><td>8</td><td>9</td> </tr>

Jacques Anidjar's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Read Entire Article