Merging Rows

Merging rows is not much different from merging columns. You simply specify instead of colspan and set the number of rows that the element is to merge together.

Where it is different from colspan is that the counting up of the elements across each row of the table is made slightly more complicated. Instead of the element taking up so many columns in the current row it takes up one element position in the current row and also as many of the following rows as it needs to in order to span the specified number of rows. This element actually extends down into the subsequent rows of the table and therefore you need to skip over the element for this column of the table when defining the subsequent rows that it spans.

Let's look at an example:

<td>row 1, Col 1</td>
<td rowspan="2">row 1 and 2, Col 2</td>
<td>row 1, Col 3</td>
<td>row 2, Col 1</td>
<td>row 2, Col 3</td>

As you can see our table still contains three columns of data but in the second row we only define the first and third of these since the second element of the first row spans both rows of our table.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow