Arcyno
Arcyno

Reputation: 4603

HTML table with different number of rows

I have a simple question :

we usually use

<table>
    <tr>
        <td> stuff1 </td>
        <td> stuff2 </td>
    <tr>
 ...
</table>

Therefore i can have on line with 3 columns and another with 4 columns. But I would like to do the contrary : on column with 3 rows and one column with 4 rows.

<table>
    <td>
        <tr> stuff1 </tr>
        <tr> stuff2 </tr>
    <td>
...
</table>

but swapping <tr> and <td> does not seem to works...

Upvotes: 0

Views: 1682

Answers (2)

niyasc
niyasc

Reputation: 4490

You can do that using rowspan property. Here is a clue :

table tr td {
  border: 1px solid black;
  }
<table>
  <tr>
    <td rowspan="2">left</td>
    <td>T-right</td>
  </tr>
  <tr>
    <td>B-Right</td>
  </tr>
</table>

Upvotes: 1

Lucian
Lucian

Reputation: 644

You can achieve this by using the rowspan attribute. It works exactly like colspan. http://www.w3schools.com/tags/att_td_rowspan.asp

<table>
  <tr>
    <td rowspan="2"></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>

Upvotes: 0

Related Questions