Html 如何摆脱电子邮件发送者的 MsoNormal 类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23671960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to get rid of class MsoNormal from emailers
提问by Kamal
Hi friends I am getting stuck trying to create an emailer ... I designed an emailer then cut that design into HTML and send that emailer using office 2007 to my gmail... when i checked emailer in my gmail i got this
嗨,朋友们,我在尝试创建电子邮件时遇到了困难......我设计了一个电子邮件,然后将该设计剪裁成 HTML 并使用 office 2007 将该电子邮件发送到我的 gmail...当我在我的 gmail 中检查电子邮件时,我得到了这个
There are spaces showing after debugging I found there are <p class="MsoNormal">
after every <tr>
. To reset this I also applied following style but it doesn't work... please help me guys
调试后显示空格,我发现<p class="MsoNormal">
每个<tr>
. 要重置它,我还应用了以下样式,但它不起作用......请帮助我
CSS
CSS
body {
color: #fff;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
}
html {width: 100%;}
body {width:100% !important;}
.ReadMsgBody, .ExternalClass {width:100%; display:block !important;}
table td {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;}
#backgroundTable {margin:0; padding:0; width:100% !important;}
p.MsoNormal {margin: 0px}
img{display:block;}
回答by John
There is no way to prevent msoNormal tags when sending from Outlook. You can hide the effects in many clients, but as Gmail needs inline CSS (strips the style tag), it is not possible to avoid in Gmail. Here is a related article on the topic
从 Outlook 发送时,无法阻止 msoNormal 标记。您可以在许多客户端中隐藏效果,但由于 Gmail 需要内联 CSS(去除样式标记),因此在 Gmail 中无法避免。这是有关该主题的相关文章
There are ways you can design around it however. You could use one large (uncut) background image and put all of the content in front for example.
但是,您可以通过多种方式围绕它进行设计。例如,您可以使用一张大的(未剪切的)背景图像并将所有内容放在前面。
回答by Kiss
One trick you could try (work in most cases) is adding this style to every td where the image is
您可以尝试的一个技巧(在大多数情况下有效)是将此样式添加到图像所在的每个 td
<td style="line-height: 25%">
If that doesn't work, try applying it on your <tr>
(I honestly don't know how it works, just that it works in some cases)
如果这不起作用,请尝试将其应用于您的<tr>
(老实说,我不知道它是如何工作的,只是在某些情况下有效)
回答by Jeorge Philip
How about you put the display: block; per image?
你把 display: block; 每个图像?
Ex:
前任:
<img src="YOUR.IMG.SRC" alt="" style="display: block; margin: 0; padding: 0;" border="0"/>
This worked for me. The hardest part is removing that p.MsoNormal on Outlook, still figuring that out since Outlook's recent versions still has that bug. And also, put ; on every style you type. CSS would be messy if not.
这对我有用。最难的部分是删除 Outlook 上的 p.MsoNormal,由于 Outlook 的最新版本仍然存在该错误,因此仍在解决这个问题。而且,把; 在您键入的每种样式上。如果没有,CSS 会很乱。