Search code examples
html-tablehtml-email

Aligning two tables with different number of rows inside a parent table


Inside a parent table, I have table1(with 3 rows) and table2(with 2 rows). I need table2 to align at the top with table1 and right now its centering table2. I know about divs and float but this page is getting sent through a mail server and it renders the page all weird and I have to use tables.

I tried to post some images of my code but its saying I need at least 10 reputations to post images?


Solution

  • try adding valign="top" on your parent table td elements as the default vertical alignment is center or middle for td elements

    <table id="parent">
        <tr>
            <td valign="top">
                <table id="table1"></table>
            </td>
            <td valign="top">
                <table id="table2"></table>
            </td>
        </tr>
    </table>