Outlook 桌面应用程序忽略边距 0 和填充 0

发布于 2025-01-09 04:23:21 字数 220 浏览 3 评论 0原文

我正在使用 HTML 和 CSS 发送电子邮件。在大多数电子邮件客户端上,它工作正常,但 Outlook 桌面应用程序(我使用 Windows)会忽略 margin: 0padding: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

找回味觉 2025-01-16 04:23:21

并非所有电子邮件客户端都接受所有形式的 CSS 选择器。查看电子邮件客户端 CSS 支持指南,检查哪些客户端接受哪些客户端CSS 选择器。

作为替代方案,您可以将 padding 添加到内联元素(例如 body 标记):

<body style="padding: 0;">
</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, the body tag):

<body style="padding: 0;">
</body>

However, Outlook Desktop does not accept margin, unfortunately. Here is a list of all the CSS that Outlook does not accept.

很快妥协 2025-01-16 04:23:21

作为一般规则,假设电子邮件客户端仅查看内联样式。标题中的样式标签将被忽略。

这是制作一致的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文