Outlook 2007 和 2010 中的 Rich HTML 电子邮件...如何删除上边距?
我有一封内容丰富的 HTML 电子邮件。我想知道在 Outlook 2010 和 2007 中如何使布局中的表格与浏览器边缘齐平?
看看这张图片:
粉色是 body 标签的背景颜色,灰色是 body 标签的背景颜色表的背景。它们的所有内容都是 0(边距、填充等)。但仍有一些空间。粉红色不应该是可见的。
有谁知道如何消除身体上的这个空间?
另外,这里还有一些用于电子邮件开头的 CSS:
<html>
<head>
<style type="text/css">
html, body{ width:100%; }
body{ background-color:#ff00ff; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
</head>
<body topmargin="0" style="margin:0; padding:0; width:100%; background-color:#ff00ff;" >
<table topmargin="0" align="center" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;border: 0; margin:0; padding:0; background-color:#eee;" >
干杯!
I have a rich HTML email. I was wondering how, in Outlook 2010 and 2007, you get the table in the layout to sit flush with the edge of the browser?
Have a look at this pic:
The pink is the background color of the body tag and the grey is the bg of the table. They both have 0 everything (margin, paddting ect). But there is still some space. The pink should not be visible.
Does anyone know how to get rid of this space on the body?
Also here’s some CSS for the start of the email:
<html>
<head>
<style type="text/css">
html, body{ width:100%; }
body{ background-color:#ff00ff; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
</head>
<body topmargin="0" style="margin:0; padding:0; width:100%; background-color:#ff00ff;" >
<table topmargin="0" align="center" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;border: 0; margin:0; padding:0; background-color:#eee;" >
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Outlook 2007/2010 向所有 html 电子邮件添加 15 像素顶部/底部和 10 像素左/右正文填充。你无法摆脱它。
这里有一个伪造完整背景的技巧:http://www.campaignmonitor。 com/forums/viewtopic.php?pid=17048Outlook 2007/2010 adds 15px top/bottom and 10px left/right body padding to all html emails. You can't get rid of it.
Here's a trick to fake full backgrounds: http://www.campaignmonitor.com/forums/viewtopic.php?pid=17048Outlook 使用损坏的 Microsoft Word HTML 引擎,并且与浏览器没有任何合理的相似之处。
如果您有 Word,您至少可以以 html 格式打开电子邮件并查看它如何呈现,而无需经历整个邮件周期。
Outlook 确实是任何电子邮件营销人员的克星。它绝对是一堆垃圾,甚至无法支持最基本的 CSS 期望。
由于 Outlook,我不得不与图形设计师就电子邮件作为平台的局限性进行许多坦率且令人失望的讨论。微软在使用 Outlook 的 Word 引擎方面严重倒退了一步。
Outlook uses the broken Microsoft Word HTML engine and is not based on any reasonable resemblance to a browser.
If you have Word, you can at least open your email as html and see how it renders it without having to go through the whole mail cycle.
Outlook really in the bane of any email marketer. It is an absolute pile of crap and fails to support even the most basic CSS expectations.
I'd have to have many frank and disappointing discussions with graphic designers over the limitations of email as a platform due to Outlook. Microsoft has seriously made a step backwards in using the Word engine for Outlook.
奇怪的是
不起作用。
我发现,在 Outlook 2007/2010 中,如果您将
padding-top
应用于某列,但未应用于同一行中的其他列,则 Outlook 会出于某种原因将该填充应用于所有列。您能否粘贴更多电子邮件代码,以便我们看看是否是其他原因导致了问题。Stange that the
<body style="padding:0px; margin:0px;">
doesn't work.I find that with outlook 2007/2010 that if you have
padding-top
applied to a column but not the other columns in the same row Outlook will apply that padding to all the columns for some reason. Are you able to paste more of the email code so we can have a look that its not something else causing the issue.尝试在
标记上使用
margintop="0" marginleft="0" marginright="0"
(已更新为完整示例):您需要设置600 的宽度到您电子邮件的宽度。
正文标签和 CSS 中的填充/边距值存在跨电子邮件客户端错误。
注意 - 这只是必要的,并且仅适用于 body 标签。
Try using
margintop="0" marginleft="0" marginright="0"
on the<body>
tag (updated to full example):You will need to set the width of 600 to whatever the width of your email is.
There are cross-email client bugs with body tags, and padding/margin values in CSS.
NB - this is only necessary, and only works, on the body tag.
使用纯 CSS(我不确定 IE 的制造商是否喜欢阅读该内容),您可以使用
!important
来强制的边距和填充。 table>
和为
0px
:也许可以,但也许不行。我不确定 Outlook 如何处理 CSS...
With pure CSS (I'm not sure the makers of IE like reading that), you can use
!important
to force the margin and padding of the<table>
and the<body>
to be0px
:Maybe it'll work, but maybe not. I'm not sure how Outlook handles CSS...
由于 Outlook 不支持保证金 -参考。我解决这个问题的方法如下。希望它能帮助某人。
As outlook doesn't support margin -reference. My work around to this issue was as below. Hope it will help someone.
我知道这有点晚了,但我看到这篇文章并认为您也可以测试这个方法。
http:// theboywhocriedfox.com/code-snippets/fixing-the-forced-body-padding-in-outlook-2007-2010-and-2013/
I know this is a bit late, but I came across this post and thought you might be able to test this method as well.
http://theboywhocriedfox.com/code-snippets/fixing-the-forced-body-padding-in-outlook-2007-2010-and-2013/