大厦Mayem的答案,这是几乎所有的电子邮件客户端100%正确的,我想补充一点,以它。这完全不适用于Outlook,并且可能会出现Gmail应用程序问题。
1.)无论CSS或HTML调整大小(大小还取决于计算机上的PPI设置),Outlook几乎总是会强制映像的实际大小,因此始终最好根据需要调整图像大小他们在Outlook中显示,然后控制所有其他客户端的大小。
2.)Outlook不支持背景图片,所以您需要使用VML来模仿这个outook - 最好的地方是http://backgrounds.cm/。它会为你做大部分工作。
3)的Gmail不读的样式表,等等Gmail应用程序时显示的代码可能会导致一个畸形的版本 - 这是你需要从设计/配置立体
4上工作。)剩余边距和覆盖内容上的大部分代码都需要用于电子邮件HTML,因为它在许多电子邮件客户端上都不受支持。
参见下面是从混乱的答案建有一些调整和Outlook条件VML中添加的代码。
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%; max-width:960px; margin:0 auto;">
<tr>
<td background="http://placehold.it/960x550" width="960" height="550" style="background-size:auto 100%; background-image:url('http://placehold.it/960x550');">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:960px;height:550px;">
<v:fill type="tile" src="http://placehold.it/960x550" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
<img src="http://placehold.it/100/09f/fff.png" style="margin-left:35%;" />
<h1 style="text-align:center;"><a href="#" style="text-decoration:none;color:white;"> Some text on top of bg-image inside a td</a></h1>
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td> </tr>
</table>
你“运行的代码片断”没有工作.. – pcs
@saina,当然,我删除了正确的链接 – yerassyl
请检查我的答案@yerassyl – pcs