【问题标题】:Outlook HTML email - vertical gaps in image slicesOutlook HTML 电子邮件 - 图像切片中的垂直间隙
【发布时间】:2013-03-24 06:23:38
【问题描述】:
【问题讨论】:
标签:
html
email
outlook
slice
【解决方案1】:
您的 colspan 太多,这可能会导致问题。你应该嵌套你的表。
我已经创建了数百封电子邮件,并且从未遇到过由电子邮件代码中的换行引起的空格问题。 (Outlook 2007 是我检查电子邮件的第一件事)
使用display:block; 并将图像单独保存在自己的<td> 中始终是一种好习惯。
试试这样的方法:
<html>
<head>
<title>Ambassador Newsletter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>img {display:block}</style>
</head>
<!--REPLACE the following text with the path to the images on your server http://emaniocreative.com/eblasts/3_26_2013/ -->
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF"><table bgcolor="#ebebeb" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top" style="padding-top:30px; padding-bottom:30px;">
<table id="Table_01" width="650" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" style="border-collapse: collapse;">
<tr>
<td>
<!-- NEST A TABLE INSTEAD-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#770000">
<tr>
<td style="padding:20px;">
header
</td>
</tr>
</table>
<!-- /NEST-->
</td>
</tr>
<tr>
<td>
<!-- NEST A TABLE INSTEAD-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding:20px;">
Body section 1
</td>
</tr>
<tr>
<td style="padding:20px;">
Body section 2
</td>
</tr>
</table>
<!-- /NEST-->
</td>
</tr>
</table>
</td></tr></table></td></tr></table></body></html>
在我的示例中,我使用填充而不是单元格作为间距。
您永远不需要空白间隔图像。如果您不想使用填充,请在空单元格中使用 &nbsp;:
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#770000">
<tr>
<td height="20" colspan="3">
</td>
</tr>
<tr>
<td width="20">
</td>
<td width="610">
header
</td>
<td width="20">
</td>
</tr>
<tr>
<td height="20" colspan="3">
</td>
</tr>
</table>
附带说明一下,例如,从 Outlook 转发到 Gmail 时,垂直分隔存在不可避免的问题(感谢添加了 mso.normal p 标签),但对于初始收件人来说没有问题。
【解决方案2】:
别去
display: [anything]
如果您希望包含 Outlook 2007。请参阅 http://www.xequte.com/support/maillistking/css_in_emails.html,了解您可以使用哪些 CSS 样式以及最好不要使用哪些样式。
不要在结尾使用任何空格
<td>
并且不要在
之前使用任何空格
</td>
你也应该避免
<style>...</style>
因为这很可能会被完全删除。总是选择内联样式。而且我知道这不是真正答案的一部分,而只是作为一个提示:如果您正在制作 HTML 时事通讯,请将它们制作成您正在为 Internet Explorer 4 制作它们。像 Outlook 这样的电子邮件客户端使用最荒谬的 CSS-你可以想象的渲染器。甚至 Internet Explorer 5 在呈现 CSS 方面也比现代 Outlook 更复杂。
哦,顺便说一句:如果您的时事通讯的收件人有可能在 hotmail、gmx 或 gmail 中在线阅读它们,那么您也应该检查它们。您会惊叹不已,想知道那些在线客户端如何处理您的代码以及它们注入的内容。
【解决方案3】:
你有大量的空白导致差距:
<a href="mms://a1783.v167326.c16732.g.vm.akamaistream.net/7/1783/16732/0/QPS.Onstreammedia.com/origin/jjready2/%5bInbox%5d/Talent%20Management/CDF%201-18_WMV.wmv">
<img style="display:block" src="http://emaniocreative.com/eblasts/3_26_2013/Message-from-Dominic-&-Louise.jpg" width="360" height="257" border="0" alt="Message from Dominic & Louise - Video"></a>
尝试去掉空格。display:block 也不能像 display:inline-block 那样工作(你可能想要后者)你不能将 margin 或 padding 等格式添加到 SPAN。我会将您拥有的内容保留为 IMG 和 DIV 元素,但是如果您使用的是 TABLE,您可能需要 border-collapse:collapse; 属性集。
还要注意,如果您使用的是display:inline-block,您需要在元素之间去掉 ALL 空格:
<tr>...</tr><tr>...</tr>
而不是你目前拥有的:
<tr>
...
</tr>
<tr>
...
</tr>