I am trying to create the following design for an email:
<table align="center" width="600" border="0" cellpadding="10" cellspacing="0">
<tr bgcolor="pink">
<td align="left" width="50%" height="40px">
Left Column Text
</td>
<td align="right" width="50%" height="40px">
Right Column Text
</td>
</tr>
</table>
But it doesn’t work when forwarding the above table from Outlook to Gmail for example.
When I forward this email from Outlook, it adds extra elements to the <td>
s:
<td align="left" width="50%" height="40px">
<p align="right" style="text-align:right;">
<span dir="RTL"> Some Text </span>
</p>
</td>
And it makes the text align to the right on both columns. Why?
This is how it looks when forwarded from Outlook to Gmail: (Note that in the below example I manually changed the left column to align="right"
just to mimic the behaviour)
<table align="center" width="600" border="0" cellpadding="10" cellspacing="0">
<tr bgcolor="pink">
<td align="right" width="50%" height="40px">
Left Column Text
</td>
<td align="right" width="50%" height="40px">
Right Column Text
</td>
</tr>
</table>
3
Answers
In Outlook you have to work with static pixels. The solution is to create an inner table specially for Outlook that does not appear to other email clients. Below you’ll find a starting point for email clients.
It is important to style all elemnts inline (in the element tag) because some email clients remove the style in the
<head>
section.Html emails are frustrating for anyone because there are so many email clients which show so many different results.
I looked into some professional email layouts and they are several kilobytes to result in a cross email client output.
Please try this (simplified) version with 2 columns (alignment left and right). Note that, for compatibilty reasons, the max width is set to 600px.
I feel your pain on html emails. As per another answer, Outlook needs very exact html and requires that basically everything be a table (or cell) in order to be forced to "behave".
I have inserted a middle td instead and have kept the alignment as left.
Try also always using full inline style as well on every single element (as mentioned in another answer) as well as copying all the css into the head AND the body.
I noticed that you weren’t always using style="" in your example and this may be required (do not quote me on that). However, I suspect that the lack of styling may be making gmail misbehave as you said it is adding its own. It seems to think there is a span but you did not write one, therefore try using parargaphs and styling each one instead of just putting text in the td.
I added a bit more text just so I could see how it would look.