How to centre a HTML email in outlook and make the background color filled?

天涯浪子 提交于 2020-01-05 08:12:13

问题


Just a quick question - I am using Campaign Monitor to send out HTML E-mails, however they are not centred in outlook, but are in Apple mail and gmail. I have tried adding the following css just for outlook:

.readMsgBody .c-ReadMessagePartBody{
background-color: #F3F3F3;
padding-left: 15%;
padding-right: 15%;
}

as well as this I have set background Colors for my HTML and Body tags. as well as a table within the body. And aligned all of them to centre.

Thank you.


回答1:


tl;dr Outlook doesn't like heavily coded e-mails because it uses a word processor or archaic software to read them. Use table design, and make the parent table the background color.

Outlook 2007, 2010 and 2013 use Microsoft Word (versions 2007, 2010 and 2013, respectively) to render emails. Yes, a word processor is used to render emails in newer versions of Outlook! Outlook’s usage of Word as a rendering engine resulted in a disappointing setback to CSS support for emails viewed in Word, along with a ton of frustrating quirks, leading to some backlash in the email design community. In fact, there is even a website dedicated to their cause. -litmus.com

Even older versions of outlook use an ancient version of Internet explorer. Add in the fact that most Outlook users will also have extra security measures, since they're most likely using it due to a work network and it add even more layers for code to become contaminated.

The easiest way to make sure that your e-mail is supported across the board is to limit e-mail contact with CSS. Make sure your CSS is saved within the e-mail code, and use mostly inline HTML styling. Use tables to organize.

Here is an example from an e-mail I recent sent out.

    <table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" bgcolor="#f0f0f0" valign="top">

<table width="600" cellpadding="0" cellspacing="0" border="0" class="320-wide" style="min-width:600px">
<tr>
<td align="center" bgcolor="#f0f0f0">
</table>

This puts in place the background for the rest of the e-mail.



来源:https://stackoverflow.com/questions/26275221/how-to-centre-a-html-email-in-outlook-and-make-the-background-color-filled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!