Outlook 2010和HTML表格

coo*_*pix 5 html email outlook

我只是在创建一些电子邮件通讯,而无法确定Outlook如何强制显示我的HTML表。

有一个简单的例子:

<table cellpadding="0" cellspacing="0" id="outlookHack" 
   style="table-layout:fixed; border: 0; background-color: #1E6C9D; 
          background-image: url(http://www.komix.cz/upload/img_bg.png); 
          background-repeat: repeat-y; margin-top: 0px; margin-bottom: 0px; 
          padding: 0px; margin-left: auto; margin-right: auto; 
          text-align: center;width: 620px;" width="620">
<tr>
  <td width="10" style="width: 10px; background:inherit;" height="10">&nbsp;</td>
  <td  width="600" style="width: 600px; background:ihnerit;" height="10"></td>
  <td width="10" style="width: 10px; background:inherit;" height="10">&nbsp;</td>
<tr>
<tr>
  <td width="10" style="width: 10px; background: inherit;">&nbsp;</td>
  <td  width="600" style="width: 600px; background: white;">some content...</td>
  <td width="10" style="width: 10px; background: inherit;">&nbsp;</td>
<tr>
</table>
Run Code Online (Sandbox Code Playgroud)

问题是,左列和右列的固定大小应为10px,但是Outlook 07/10会将其呈现为+/- 5px。

bpe*_*n76 3

KISS——保持简单(愚蠢)

Outlook 07-present 使用Word 的渲染引擎,它基本上是IE(它是愚蠢的)的进一步简化。它迫使您重新编码到 html 1 标准,并且确实限制了您可以做的事情。对于初学者来说,基本上放弃复杂的 CSS。它可以使用(内联),但其中大部分不起作用。有关兼容性请参阅此文档

因此,使用兼容性图表,后台支持几乎不存在......失去它。不支持背景重复,并且填充也没有得到很好的支持。

现在,如何解决您的填充问题?您可以使用单元格填充来添加空间,但这有时会对您不希望填充的区域产生不良影响。有些人使用嵌套表来提供必要的填充,使用外部表来控制页面布局,使用内部表来控制段落。请注意,根据文档,还支持边距,因此您可以在段落上使用边距,放弃 10 像素的左列和右列,转而使用具有 10 像素边距的段落。

另外,请注意,您应该避免任何简写 CSS,即border:1px solid #000

谢谢,微软。虽然您的渲染引擎质量下降和对基本标准的普遍回避让我们 UI 开发人员疯狂,但您也为我们赚了很多额外的钱。