tags:

views:

216

answers:

1

I have a problem. I want two tables to have the same height. If the left table contain longer text than the right table i want it to be as long as the left table.

This is how it looks now:
http://i42.tinypic.com/34rwys1.png

I cant set height because that would limit how much text you can write..

This is how i want it:
http://i43.tinypic.com/2dhu32a.png

Code:

<table cellspacing="0" width="30%" align="left" class="rowA">
<tr>
    <td>
    Sed ut perspiciatis unde omnis iste natus error sit voluptatem 
    accusantium doloremque laudantium, totam rem aperiam, eaque ipsa 
    quae ab illo inventore veritatis et quasi architecto beatae vitae dicta 
    sunt explicabo. "Sed ut perspiciatis unde omnis iste natus error sit 
    voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque 
    ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae 
    dicta sunt explicabo. 
    </td>
</tr>
</table>

<table cellspacing="0" width="70%" align="right" class="rowB">
<tr>
    <td>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do 
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut 
    enim ad minim veniam, quis nostrud exercitation ullamco laboris 
    nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor 
    in reprehenderit in voluptate velit esse cillum dolore eu fugiat
    nulla pariatur. Excepteur sint occaecat cupidatat non proident, 
    sunt in culpa qui officia deserunt mollit anim id est laborum.
    </td>
</tr>
</table>

Thanks in advance.

+2  A: 

Can you use two side-by-side cells instead?

<table>
  <tr>
    <td style="width: 30%">Left Column</td>
    <td style="width: 70%">Right Column</td>
  </tr>
</table>

Edit - Just for completeness... if there is a technical reason someone HAS to use two separate containers such as divs or tables but you need them to be the same height, there is a small jQuery script that does just that which degrades nicely. It determines the tallest container then sets the other's min-height attribute to match.

DavGarcia
nice! that worked...didnt think of that