为Gmail设置HTML电子邮件样式 [英] Styling HTML email for Gmail

查看:260
本文介绍了为Gmail设置HTML电子邮件样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在生成一个使用内部样式表的html电子邮件,即

I'm generating a html email that uses an internal stylesheet, i.e.

<!doctype html>
<html>
<head>
  <style type="text/css">
    h2.foo {color: red}    
  </style>
</head>
<body>
 <h2 class="foo">Email content here</foo>
</body>
</html>

在Gmail中查看时,似乎内部样式表中的所有样式都被忽略。 Gmail似乎忽略了除内联规则以外的所有样式,例如

When viewed in Gmail it seems all the styles in the internal stylesheet are ignored. It seems Gmail ignores all styles other than inline rules, e.g.

 <h2 style="color: red">Email content here</foo>

这是我使用Gmail查看HTML电子邮件时的唯一选项吗?

Is this my only option for styling HTML emails when viewed with Gmail?

推荐答案

使用内联样式的一切。此网站会将您的课程转换为内联样式: http://premailer.dialect.ca/

Use inline styles for everything. This site will convert your classes to inline styles: http://premailer.dialect.ca/

这篇关于为Gmail设置HTML电子邮件样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆