[英]CSS styles in mail body in Gmail
有谁知道或可以确认 Gmail 是否从邮件正文中删除了样式块? 他们声称允许在 HTML 正文中使用样式标签。 但是,在我的测试中,主体中的样式标签已从 Gmail 中删除。我用这个 HTML 进行了测试,仅应用了头部样式。
<html> <head> <style> h1{color:red;} </style> </head> <body> <h2>Hi from H2-1</h2> <style>h2{color:green;}</style> <h1>Hi from H1</h1> <h2>Hi from H2-2</h2> </body> </html>
您必须为几乎所有主要的电子邮件提供商执行所有内联样式。
<h2 style="color: #ff00ff;">H2 Title</h2>
<p style="color: #fff; padding: 10px 0; text-align: center;">This is a paragraph section.</p>
通常,使用html电子邮件是一个巨大的痛苦。 我只建议您通过某些预邮程序运行html,例如: http ://premailer.dialect.ca/。 应该注意内联所有样式。 在电子邮件领域没有简单的答案,那里仍然是2000年。
根据我的简单测试,如果您在内联 styles 中使用CSS 中的无逗号颜色函数,整个style
属性将从该元素中删除。
这个HTML
<span style="background-color:rgb(239 68 68 / 1);color:rgb(255 255 255 / 1 );font-weight:700;margin-left:1rem;margin-right:1rem;padding:1rem;"> with slash without comma </span>
<span style="background-color:rgb(239 68 68 );color:rgb(255 255 255 );font-weight:700;margin-left:1rem;margin-right:1rem;padding:1rem;"> without slash without comma </span>
<span style="background-color:rgb(239, 68, 68);color:rgb(255, 255, 255 );font-weight:700;margin-left:1rem;margin-right:1rem;padding:1rem;"> with commas </span>
如果使用 postcss, postcss-preset-env应该有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.