Why doesn’t Gmail display CSS in email

You’ve worked hard to make sure that your electronic newsletter is coded in pretty HTML and CSS. Then you open it up in a web-based email reader and the CSS is gone!

Gmail ripped out the style tag. While this makes some sense from a security standpoint — we wouldn’t want some sneak CSS in a phishy email messing with your email reader — Google could go further and rewrite the CSS to make it inline, stripping out the CSS class names as it went. Of course, that increases the size of the message as demonstrated.

Many webmail clients support style tag based CSS. Perhaps this is why Gmail is still in beta. Email readers need standards as much as web browsers! Fortunately, there is a guide online that outlines what CSS is support by different email clients.

It turns out that enough of our users use online webmail readers and wanted pretty emails that we’re accommodating gmail and throwing out the extra bits to make it happen. I noticed that none of my favorite refactoring tools helped in the process.

Long live the user experience!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s