Issue
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>
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>
Is this my only option for styling HTML emails when viewed with Gmail?
Solution
The answers here are outdated, as of today Sep 30 2016. Gmail is currently rolling out support for the style
tag in the head
, as well as media queries. If Gmail is your only concern, you're safe to use classes like a modern developer!
For reference, you can check the official gmail CSS docs.
As a side note, Gmail was the only major client that didn't support style
(reference, until they update anyway). That means you can almost safely stop putting styles inline. Some of the more obscure clients may still need them.
Answered By - Matthew Johnson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.