Artefact2 Artefact2 - 1 month ago 6
HTML Question

Rowspan arrangement with coprime numbers

I have data (A, B1, B2, C1, C2 and C3) that I'd like to put in a table like this:

+----+----+----+
| | B1 | C1 |
| +----+ |
| A | B2 +----|
| +----+ C2 |
| | B3 | |
+----+----+----+


Using rowspans, I came up with this:

<table>
<tr>
<td rowspan=6>A</td>
<td rowspan=2>B1</td>
<td rowspan=3>C1</td>
</tr>
<tr><td rowspan=2>B2</td></tr>
<tr><td rowspan=3>C2</td></tr>
<tr><td rowspan=2>B3</td></tr>
</table>


But it doesn't work. I tried several combinations and variants, but neither of them work either.

I'd like a solution that works with any coprime numbers if possible (the example here is with 2 and 3).

I made a jsfiddle ( http://jsfiddle.net/NPETb/ ) with this code if you want to hack it quickly yourself.

Answer

Your rowspans add up to 6, but there aren't actually 6 rows in your table.

You need to add the rows which end up being empty as well:

<table> 
<tr>
    <td rowspan=6>A</td>
    <td rowspan=2>B1</td>
    <td rowspan=3>C1</td>
</tr>
<tr><!-- no new cells here --></tr>
<tr><td rowspan=2>B2</td></tr>
<tr><td rowspan=3>C2</td></tr>
<tr><td rowspan=2>B3</td></tr>
<tr><!-- no new cells here --></tr>
</table> 
Comments