I have following html in email template.
I am getting different view in MS Outlook and in gmail for the same.
<tr>
<td bgcolor="#7d9aaa" style="color: #fff; font-size:15px; font-family:Arial, Helvetica, sans-serif; padding: 12px 2px 12px 0px; ">
<span style="font-weight: bold;padding-right:150px;padding-left: 35px;">Order Confirmation </span>
<span style="font-weight: bold;width:400px;"> Your Confirmation number is {{var order.increment_id}} </span></td>
</tr>
How to fix this?
I had the same problem and ended up actually using
border
instead ofpadding
.I changed to following and it worked for me
Update based on Bsalex request what has actually changed. I replaced span tag
with table and td tags as following
As monners says some email clients are horrible handling paddings. You can use empty rows and cells as he suggests (with the precaution to set the line-height to 1, if not the line height of the td may be higher than the padding).
I have particulary found another solution, using borders the same colour of the background. I've tested this solution positively in gmail (and gmail for business), yahoo mail, outlook web, outlook desktop, thunderbird and works correctly.
Example:
In addition, here is an excelent guide to make responsive newsletters WITHOUT mediaqueries, I've been using this guide for long now and it's excellent: https://webdesign.tutsplus.com/tutorials/creating-a-future-proof-responsive-email-without-media-queries--cms-23919
And you can test all your email in: https://putsmail.com/
And always remember to make your css inline, I use: https://inliner.cm/
Finally, if you have doubts about css support you can go here: https://templates.mailchimp.com/resources/email-client-css-support/
or here: https://www.campaignmonitor.com/css/
Just use
<Table cellpadding="10" ..> ... </Table>
Don't use px.Works in MS-Outlook.
Padding will not work in Outlook. Instead of adding blank Image, you can simply use multiple spaces(& nbsp;) before elements/texts for padding left For padding top or bottom, you can add a div containing just spaces(& nbsp;) alone. This will work!!!
Unfortunately, when it comes to EDMs, Outlook is your worst enemy. Some versions don't respect padding when a cell's content dictates the cell dimensions.
The approach that'll give you the most consistent result across mail clients is to use empty table cells as padding (I know, the horror), but remember to fill those tables with a blank image of the desired dimensions because, you guessed it, some versions of Outlook don't respect height/width declarations of empty cells.
Aren't EDMs fun? (No. They are not.)