Outlook 桌面应用程序忽略边距 0 和填充 0
我正在使用 HTML 和 CSS 发送电子邮件。在大多数电子邮件客户端上,它工作正常,但 Outlook 桌面应用程序(我使用 Windows)会忽略 margin: 0
和 padding: 0
。我已经用CSS这样声明了它:
*{
margin: 0;
padding: 0;
}
并且我找不到解决方案。
I am making a e-mail with HTML and CSS. On most of the e-mail clients it works fine but the Outlook Desktop App (I use Windows) ignores the margin: 0
and padding: 0
. I have declared it this way with CSS:
*{
margin: 0;
padding: 0;
}
And I can't find the solution for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并非所有电子邮件客户端都接受所有形式的 CSS 选择器。查看电子邮件客户端 CSS 支持指南,检查哪些客户端接受哪些客户端CSS 选择器。
作为替代方案,您可以将
padding
添加到内联元素(例如body
标记):但是,Outlook 桌面版不接受
margin
, 很遗憾。以下是 Outlook 所使用的所有 CSS 的列表不接受。Not all e-mail clients accept all forms of CSS selectors. Have a look at this CSS Support Guide for Email Clients to check which clients accept which CSS selectors.
As an alternative, you could add
padding
to an inline element (for example, thebody
tag):However, Outlook Desktop does not accept
margin
, unfortunately. Here is a list of all the CSS that Outlook does not accept.作为一般规则,假设电子邮件客户端仅查看内联样式。标题中的样式标签将被忽略。
这是制作一致的 HTML 电子邮件特别乏味的原因之一。另一个不好的地方是需要嵌套表格以使它们能够响应移动设备。
As a general rule assume email clients only look at inline styling. Style tags in the header will be ignored.
This is one of the aspects that makes crafting consistent HTML emails particularly tedious. The other bad one being the need to nest tables to make them mobile responsive.