14mble
14mble

Reputation: 119

Any idea how I could get two tables side by side, and third table at the bottom

I am trying to make a email signature with html. But what I am trying to do is, having 2 tables side by side. And the third one at the bottom. I managed to do this by using align="left" on the first table. However, I have 3 tables. The first two are supposed to be side by side. But the third one has to be at the bottom. It works in browser. But in Outlook, the bottom table goes to the right, following the second table. The first has text and the second has an image.

I made on paint my beautiful designs for what I am trying to get:

What I want:
Picture of what I want

What I get:
Picture of what I get

I tried the following:
1. Using display:inline-block, does not work
2. Using align="left"for first and second, and even all of them. Nope
3. Using float, works in browser. But not in Outlook.
4. Placing the image in a cell, does not look nice.

The Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="nl" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title>emailsignature</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

a
{
    color: white;
    text-decoration: none;
}

table{
    border-collapse: collapse;
    mso-cellspacing: 10px; 
    mso-padding-alt: 10px 10px 10px 10px;
    mso-table-lspace: 0pt !important;
    mso-table-rspace: 0pt !important;
}

td{
    padding: 0px;
    mso-table-lspace: 0pt !important;
    mso-table-rspace: 0pt !important;
}

.footer{
    font-size: 6.5pt;
}

</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;width: 650px;margin:0;padding:0 !important; mso-line-height-rule: exactly;">
    <table bgcolor="#FFFFFF" id="Table_01" width="325" height="200" border="0" align="left">
        <tr>
            <td height="25" width="650"></td>
        </tr>
        <tr>
            <td width="173" height="25">
                <p style="font-size:16pt; font-weight:600; margin:0;">John Doe</p></td>
        </tr>
        <tr>
            <td height="21" width="173">
                <p style="font-size:11pt; font-weight:300; margin:0;">Operationeel Manager</p></td>

        </tr>
        <tr>
            <td width="245" height="12">
                <hr style="margin:0; width: 200px;"></td>
            <td width="245" height="12"></td>
        </tr>
        <tr>
            <td width="198" height="74" style="padding-bottom: 40px;">
                <p style="font-size:10pt; margin:0;">
                    Straatstraat 18<br>
                    3333 AA Rotterdam<br>
                    Telefoon: +31 (0) 10 111 11 11<br>
                    Mobiel: +31 (0) 6 111 111 111 <br>
                </p></td>

        </tr>
        </table>
<table bgcolor="#FFFFFF" id="Table_02" width="325" height="200" border="0" >
            <tr>
                <td width="15">&nbsp;</td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <img src="image" width="210" height="130" border="0" alt="logo">
                </td>
            </tr>
            <tr>
                <td width="15">&nbsp;</td>
            </tr>

        </table>
    <table bgcolor="#E53212" class="footer" id="Table_03" width="650" height="20" border="0">
        <tr>
            <td width="15">&nbsp;
                </td>
            <td width="50" style="text-align: center;" >
                <a href="https://www.google.com" title="disclaimer " target="_blank">

                    disclaimer
                </a>
            </td>
            <td width="12" height="32" style="text-align: center;">

                <p style="margin:0; color:#CE2811;">|</p>
            </td>
            <td width="48" height="18" style="text-align: center;">
                <a href="https://www.google.com" title="privacy pagina " target="_blank">

                    privacy
                </a>
            </td>
            <td width="16" height="32" style="text-align: center;">

                <p style="margin:0; color:#CE2811;">|</p>
            </td>
            <td width="200" height="18" style="text-align: center;">
                <a href="" title="algemene voorwaarden" target="_blank">

                    algemene voorwaarden
                </a>
            </td>
            <td width="13" height="32" style="text-align: center;">

                <p style="color:#CE2811; margin:0;">|</p>
            </td>
            <td width="120" height="18" style="text-align: center;">
                <a href="https://www.google.com" title="kvk uitreksel" target="_blank">

                    kvk uittreksel
                </a>
            </td>
            <td width="14" height="32" style="text-align: center;">

                <p style="color:#CE2811; margin:0;">|</p>
            </td>
            <td width="150" height="18" style="text-align: center;">
                <a href="https://www.google.com" title="wka verklaring" target="_blank">

                    wka verklaring
                </a>
            </td>
            <td width="300" height="32">

            </td>
            <td width="21" height="18">
                <a href="" title="Website van Stecon" target="_blank">
                    <img src="image" width="21" height="20" border="0" alt="Een wereldbol icoon">
                </a>
            </td>
            <td width="6" height="32">

            </td>
            <td width="20" height="18">
                <a href="https://www.linkedin.com" title="Linkedin page" target="_blank">
                    <img src="image" width="20" height="20" border="0" alt="Linkedin logo">
                </a>
            </td>
            <td width="18" height="32">
            </td>
            <td width="15">&nbsp;</td>
        </tr>
    </table>

</body>
</html>

Upvotes: 0

Views: 3856

Answers (2)

user2958788
user2958788

Reputation:

  1. You need a wrapping table to set a defined width for the tables to take up. Otherwise your content is going to span the entire width of the email window.
  2. Don't bother with heights on tables. Your content will define the height on your tables. Same goes with the heights on the table cells. Your content will do this for you, unless you're using it for spacer cells etc.
  3. You have a mismatch of table cells between your table rows. You either need to have two cells in all rows to match the horizontal line, or add colspan="2" to all rows with only one cell.
  4. Your widths on all of your cells will not work. When there is only one cell in a row, that cell will fill the width set by the table. There is no way around this, this is the natural behaviour of table cells. Remove widths off of rows with only one cell. Also remove the width off of one of the cells in the row with two cells. The second cell will fill the remaining width, left by the cell with a defined width.
  5. With the current 650px width set on your table, your two inner tables will not sit side by side because of a silly quirk in Outlook which forces a 20px gap between tables. Your options to get around this are 1) Increase the width of your main table to 670px. 2) Reduce the width of one or both of your inner tables by 20px total. 3) Use ghost tables to mimic a table cell structure. 4) Wrap your inner tables in table cells, as @SJ_OWOW suggested.

Here is my version of your code. I went with the table cell option from point 5 as you haven't added any mobile responsive support in your signature, so for ease I went with that. There are still a few things I'd fix but this should at least fix your major issues:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="nl" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title>emailsignature</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

a
{
    color: white;
    text-decoration: none;
}

table{
    border-collapse: collapse;
    mso-cellspacing: 10px; 
    mso-padding-alt: 10px 10px 10px 10px;
    mso-table-lspace: 0pt !important;
    mso-table-rspace: 0pt !important;
}

td{
    padding: 0px;
    mso-table-lspace: 0pt !important;
    mso-table-rspace: 0pt !important;
}

.footer{
    font-size: 6.5pt;
}

</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;width: 650px;margin:0;padding:0 !important; mso-line-height-rule: exactly;">
    
<table width="100%" border="0">
    <tr>
        <td align="center">
    
            <table width="650" border="0">
                <tr>
                    <td width="325">
                        <table bgcolor="#FFFFFF" id="Table_01" width="325" height="200" border="0" align="left">
                            <tr>
                                <td colspan="2" height="25"></td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <p style="font-size:16pt; font-weight:600; margin:0;">John Doe</p></td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <p style="font-size:11pt; font-weight:300; margin:0;">Operationeel Manager</p></td>

                            </tr>
                            <tr>
                                <td width="245" height="12">
                                    <hr style="margin:0; width: 200px;"></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td colspan="2" style="padding-bottom: 40px;">
                                    <p style="font-size:10pt; margin:0;">
                                        Straatstraat 18<br>
                                        3333 AA Rotterdam<br>
                                        Telefoon: +31 (0) 10 111 11 11<br>
                                        Mobiel: +31 (0) 6 111 111 111 <br>
                                    </p></td>

                            </tr>
                        </table>
                    </td>
                    <td>
                        <table bgcolor="#FFFFFF" id="Table_02" width="325" height="200" border="0" align="right">
                            <tr>
                                <td width="15">&nbsp;</td>
                            </tr>
                            <tr>
                                <td style="text-align: right;">
                                    <img src="image" width="210" height="130" border="0" alt="logo">
                                </td>
                            </tr>
                            <tr>
                                <td width="15">&nbsp;</td>
                            </tr>

                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table bgcolor="#E53212" class="footer" id="Table_03" width="650" height="20" border="0">
                            <tr>
                                <td width="15">&nbsp;
                                    </td>
                                <td width="50" style="text-align: center;" >
                                    <a href="https://www.google.com" title="disclaimer " target="_blank">

                                        disclaimer
                                    </a>
                                </td>
                                <td width="12" height="32" style="text-align: center;">

                                    <p style="margin:0; color:#CE2811;">|</p>
                                </td>
                                <td width="48" height="18" style="text-align: center;">
                                    <a href="https://www.google.com" title="privacy pagina " target="_blank">

                                        privacy
                                    </a>
                                </td>
                                <td width="16" height="32" style="text-align: center;">

                                    <p style="margin:0; color:#CE2811;">|</p>
                                </td>
                                <td width="200" height="18" style="text-align: center;">
                                    <a href="" title="algemene voorwaarden" target="_blank">

                                        algemene voorwaarden
                                    </a>
                                </td>
                                <td width="13" height="32" style="text-align: center;">

                                    <p style="color:#CE2811; margin:0;">|</p>
                                </td>
                                <td width="120" height="18" style="text-align: center;">
                                    <a href="https://www.google.com" title="kvk uitreksel" target="_blank">

                                        kvk uittreksel
                                    </a>
                                </td>
                                <td width="14" height="32" style="text-align: center;">

                                    <p style="color:#CE2811; margin:0;">|</p>
                                </td>
                                <td width="150" height="18" style="text-align: center;">
                                    <a href="https://www.google.com" title="wka verklaring" target="_blank">

                                        wka verklaring
                                    </a>
                                </td>
                                <td width="300" height="32">

                                </td>
                                <td width="21" height="18">
                                    <a href="" title="Website van Stecon" target="_blank">
                                        <img src="image" width="21" height="20" border="0" alt="Een wereldbol icoon">
                                    </a>
                                </td>
                                <td width="6" height="32">

                                </td>
                                <td width="20" height="18">
                                    <a href="https://www.linkedin.com" title="Linkedin page" target="_blank">
                                        <img src="image" width="20" height="20" border="0" alt="Linkedin logo">
                                    </a>
                                </td>
                                <td width="18" height="32">
                                </td>
                                <td width="15">&nbsp;</td>
                            </tr>
                        </table>

                    </td>
                </tr>
            </table>
    
        </td>
    </tr>
</table>

</body>
</html>

Upvotes: 3

SJ_OWOW
SJ_OWOW

Reputation: 182

As far as I know, outlook doesn't support float.

Also, if you think about many situations, writing a table in one table rather than several tables is good for email templates.

I am sorry for my English.

    <table style="width: 500px;">
      <tr>
        <td style="width: 50%;">
          <p style="font-size:16pt; font-weight:600; margin:0;">John Doe</p>
          <p style="font-size:11pt; font-weight:300; margin:0;">
            Operationeel Manager
          </p>
          <p style="font-size:10pt; margin:0;">
            Straatstraat 18<br />
            3333 AA Rotterdam<br />
            Telefoon: +31 (0) 10 111 11 11<br />
            Mobiel: +31 (0) 6 111 111 111 <br />
          </p>
        </td>
        <td style="width: 50%;">
          <img src="image" width="210" height="130" border="0" alt="logo" />
        </td>
      </tr>
      <tr>
        <td colspan="2" style="background-color: #f00; padding: 10px 0;">
          <ul style="padding: 0; margin: 0;">
            <li
              style="display: inline-block; border-right: solid 1px #000; margin-right: 10px; padding-right: 10px;"
            >
              <a
                href="https://www.google.com"
                title="disclaimer "
                target="_blank"
                style="font-weight: 400;"
              >
                disclaimer
              </a>
            </li>
            <li
              style="display: inline-block; border-right: solid 1px #000; margin-right: 10px; padding-right: 10px;"
            >
              <a
                href="https://www.google.com"
                title="disclaimer "
                target="_blank"
                style="font-weight: 400;"
              >
                disclaimer
              </a>
            </li>
            <li
              style="display: inline-block; border-right: solid 1px #000; margin-right: 10px; padding-right: 10px;"
            >
              <a
                href="https://www.google.com"
                title="disclaimer "
                target="_blank"
                style="font-weight: 400;"
              >
                disclaimer
              </a>
            </li>
            <li
              style="display: inline-block; border-right: solid 1px #000; margin-right: 10px; padding-right: 10px;"
            >
              <a
                href="https://www.google.com"
                title="disclaimer "
                target="_blank"
                style="font-weight: 400;"
              >
                disclaimer
              </a>
            </li>
          </ul>
        </td>
      </tr>
    </table>

And it would be good to refer to the following address.

https://www.caniemail.com/search/?s=float

https://caniuse.email/

Upvotes: 1

Related Questions