Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CSS table background not working properly in Outlook

I have a simple HTML table used in an email template:

<table id="x_formHeaderTable" style="width:100%; margin:0; padding:0; background-color:#FCE68D; border-style: solid; border-color: #000000;">
  <tbody>
    <tr>
      <td style="height:4px"></td>
    </tr>
    <tr>
      <td style="width:1%"></td>
      <td style="width:49%; text-align:left; vertical-align:top"><em>Some text in here</em></td>
      <td style="width:49%; text-align:right; vertical-align:top"><strong>Another text in here</td>
      <td style="width:1%"></td>
    </tr>
    <tr>
      <td style="height:4px"></td>
    </tr>
  </tbody>
</table>

it displays correctly (like in the snippet preview) in every client that I have tested, except for (obviously) Outlook, where it looks like this:
broken table display

What can I do to fix it?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can try to add a colspan property on the single two tds and a non breaking space (&nbsp;) to give them a with like so:

<table id="x_formHeaderTable" style="width:100%; margin:0; padding:0; background-color:#FCE68D; border-style: solid; border-color: #000000;">
  <tbody>
    <tr>
      <td style="height:4px" colspan="4">&nbsp;</td>
    </tr>
    <tr>
      <td style="width:1%"></td>
      <td style="width:49%; text-align:left; vertical-align:top"><em>Some text in here</em></td>
      <td style="width:49%; text-align:right; vertical-align:top"><strong>Another text in here</td>
      <td style="width:1%"></td>
    </tr>
    <tr>
      <td style="height:4px" colspan="4">&nbsp;</td>
    </tr>
  </tbody>
</table>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading