HTML 电子邮件模板是否需要使用 style 属性?

发布于 2024-09-29 03:00:39 字数 272 浏览 0 评论 0原文

是否存在以下场景(出于某种原因)需要将 CSS 规则直接放置在 HTML 标记的 style 属性内,而不是将 CSS 规则放置在 HEAD 的 STYLE 元素中的选择器内HTML 电子邮件模板?

(我要求提供最常见的 CSS 选择器,例如类型、类、ID、后代组合)

后续问题

Gmail 似乎是唯一与此相关的电子邮件服务不支持 STYLE 元素。这是为什么? (谷歌做出这个决定的原因是什么?)

Are there scenarios where it is (for some reason) required to place the CSS rule inside the style attribute of the HTML tag directly instead of placing the CSS rule inside a selector in the STYLE element in the HEAD of the HTML email template?

(I am asking for the most common CSS selectors, like type, class, ID, descendant combinations)

Follow-up question:

Gmail seems to be the only relevant email service that does not support the STYLE element. Why is that? (What's the reasoning behind this decision from Google?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

A君 2024-10-06 03:00:39

是的,例如 google gmail 不会处理 HEAD 中的 STYLE 元素。

查看此网站的电子邮件客户端以及他们可以/不能对 css 执行哪些操作: http://www.campaignmonitor .com/css/

Yes, for example google gmail won't handle the STYLE element in the HEAD.

Look at this site for email clients and what they can/can't do regarding css: http://www.campaignmonitor.com/css/

吲‖鸣 2024-10-06 03:00:39

大多数电子邮件客户端(但并非全部)都支持样式属性。例如,Gmail 的移动应用往往删除 head 标签和类。
如果您使用内联 css 而不是外部和内部 CSS,效果会更好。

Style attribute is supported in most of the email clients but not all. For example Gmail's mobile app tends to removes head tag and classes.
It will be better if you use inline css instead of an external and internal one.

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