Try Tuts+ Premium, Get Cash Back!
The State of CSS3 in Email Templates

The State of CSS3 in Email Templates

Tutorial Details
This entry is part 13 of 16 in the CSS3 Mastery Session
« PreviousNext »

On the heels of some of our recent findings regarding the state of CSS in email, I reckoned it was high time to shake things up a bit. So here goes – CSS3 in email lives. Ok, so I’m sorry if I made you drop your toast, there. I know you’re thinking, “But… It’s still largely experimental… In the browser, to boot!” Yes, CSS3 support is even more fickle amongst a swag of email clients that can’t even get CSS2 right. But that doesn’t mean that it’s too soon to touch any of it.

In this article, I’ll go through two properties you can use in your email templates, alongside some practical examples. So, brush off your toast and let’s get down to business.


Let’s talk CSS2 in Email.

If you’ve been designing HTML email templates for a while now, you will know that it’s often near-impossible to predict what sort of CSS-related quirks will display when testing your design across the major email clients. For example, Gmail has been notorious for stripping any CSS that isn’t inline (and for a while, not recognizing table cellpadding & cellspacing), while some clients simply choose to do away with styles altogether.

Gmail Style Tags

If you’re new to designing HTML email templates, this is probably the most foreboding thing you can possibly read. But fear not, there’s lots of info out there to bring you up to speed. Give 24ways’ ‘Rock Solid HTML Emails‘ a skim and you will see that there’s no reason to crank up the zefrank. It’s manageable.

Anyway, given that designers already have enough troubles with CSS2 support in email clients, shouldn’t CSS3 be a bit of a pipe dream? Well, read on.


Is it too Early to be Using CSS3 in Email?

Yes and no. For the yes case, there’s a couple of popular email clients that have pretty robust CSS3 support (more on that later). The great news is that a fair few of the CSS3 properties that display in these clients degrade gracefully elsewhere, meaning that there’s always a fallback option. But that said, if you want to ensure that your email templates display near-consistently across the major email clients, then CSS3 is not for you.

If you swing over to our guide to CSS in email, you will see that there’s a few email clients that have partial, or full support for a number of CSS3 properties. And for the most part, they have one thing in common – Webkit.


It’s a Webkit World

How your email template looks in Outlook isn’t anything like how it will look on your Blackberry, or when you’re viewing your webmail in Firefox.

If you have the blessing of always working on a Mac, checking your email on your iPhone and passing the time by browsing on your iPad, then you have one, fairly consistent view of the web. Unfortunately, the rest of us have to do with varying degrees of CSS support across a number of vendor platforms. How your email template looks in Outlook isn’t anything like how it will look on your Blackberry, or when you’re viewing your webmail in Firefox.

So it’s probably no surprise to you that Apple devices use the same rendering engine (the software that decides how to display HTML & CSS code) across their email apps and the Safari browser. For designers, it’s probably less of a surprise that this engine is Webkit and its CSS3 support is comparatively, very good.

That said, Webkit email clients (Apple Mail, iPhone & iPad Mail) account for roughly 20% of email clients used overall. However, what really counts are the email clients your subscribers are using. For example, a Mac software developer may have close to 100% of their customers viewing their newsletter on Apple devices.

With this in mind, let’s have a look at some of the CSS3 properties that are now creeping into your inbox.


Using Text-Shadow

Usage:

<!-- x offset, y offset, blur, and color, respectively -->
<p style="text-shadow: 2px 2px 2px #000;">
   Welcome to the latest issue of Widgets Inc monthly widget gossip.
</p>

Works in:

  • Apple, iPhone & iPad Mail
  • Yahoo! Mail, Hotmail Live! & Gmail (when viewed in browsers other than IE)
  • Android default client & Gmail

Adding drop and inner shadows with text-shadow is a non-destructive way to decorate your text. Not only can it save you from otherwise creating the same effect using an image, but it looks fine in clients where text-shadow isn’t supported.


Using Border-Radius

Usage:

<p style="border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 3px solid #000; background-color: #ccc; padding: 5px;">
   View it in a web browser.
</p>

Works in:

  • Apple, iPhone & iPad Mail
  • Thunderbird
  • Yahoo! Mail, Hotmail Live! & Gmail (when viewed in browsers other than IE)
  • Android default client

Using rounded corners on your otherwise boxy layout or square buttons is already a commonly used technique on the web. It also can give your email templates a softer, more modern look in the above email clients, plus safely reverts to square corners when not supported.

With the announcement that border-radius will be formally implemented in IE9, we can expect to see more of its use.


One Step Further: Animation and More

Some of the more extreme uses of CSS3 in email templates can be found in situations where the recipients are using a very limited set of email clients. A great example of this is the aforementioned Mac developer. Panic, the purveyors of ‘shockingly good Mac software’, send amazing invoices after you purchase one of their titles, which include – gasp! – animated, glowing buttons:

Here’s the code they used to achieve this effect:

-webkit-animation-name: 'glow';
-webkit-animation-duration: .7s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-timing-function: ease-in-out;

Of course, this wouldn’t look nearly as good in an email client other than Apple Mail, but it’s certainly a neat concept!


And Another Example…

How much CSS3 can you spot in this other email design from Panic? Click through for a larger version:

Take note of how the design resizes elegantly in the browser. And those airmail stripes? They’re forward slashes (/). Genius! To find out what went into this template, check out this article.

/
<b style="color: #f5290a;">/</b>
<i style="color: #006699;">/</i>
<b style="color: #f5290a;">/</b>
<i style="color: #006699;">/</i>
<b style="color: #f5290a;">/</b>
<i style="color: #006699;">/</i>
<b style="color: #f5290a;">/</b>
<i style="color: #006699;">/</i>

So, on that Note…

Take a look at CampaignMonitor’s email client usage reports, and swing over to the definitive guide to CSS in email to get an idea of which CSS3 properties are available across the major email clients. And of course, test, test, test. With a sprinkle of CSS3, a little experimentation and a dollop of caution, you can make your email template stand out from the crowd.

If you’re of the ability, and would like to sell your email designs, now is the time to check out the Email Templates category on ThemeForest!

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.dans-blog.com Dan Walker

    The Panic email is really well crafted and the slashes are ingenious. It’s a shame about GMail really though, you think they’d really be up to scratch with this kind of thing.

    • http://vultro.info TechMan8

      Yeah, Gmail is awesome… too bad :(

  • JF

    Nice !

  • http://www.fatlizardmedia.com Juan C. Rois

    Very interesting article, I had not even started to consider anything like this would be available any time soon. Gotta love Webkit, however I always try to stay as far away as possible from HTML email templates.
    Have enough to worry about already with regular crows browser compatibility.
    Thanks again.

  • Mr. X

    This is just a plain ripoff from Campaign Monitor’s blog.

    • http://twitter.com/sulcalibur Sulcalibur

      The author is FROM Campaign Monitor :)

  • http://www.pixeloution.com Erik Wurzer

    Nice article. I find HTML email to be a real pain under the best circumstances, so having good references is very nice.

  • http://ebiene.de Sergej Müller

    Fine article, thanks.

    The html & css code for the animated call to action button is summarized here: http://playground.ebiene.de/2530/pulsierender-webkit-button/

  • http://aext.net AEXT.NET MAGAZINE

    It would be crazy if we can make CSS3 for our email. I’m not sure about other peoples, but I always disable HTML content in email. lol

  • http://www.designreverb.com Todd Austin

    Great timing for this article. I was just asked this morning to create a html emai. I also used http://24ways.org/2009/rock-solid-html-emails as a guide.

  • http://www.joomlahackers.net Joomla & Magento Services

    Hi…
    Have you got a hack for CSS3 in IE browsers ?

    Im really looking for this.

  • http://www.themerchantofvenice.com.au josh

    OT
    the links in your articles are almost invisible, i discover them by chance, ’bout the rest keep going

  • http://www.creativeglo.co.uk James

    Interesting article, it’s great to see some leading edge ideas being expored, and it’s undestandable that Outlook wasn’t mentioned here. However, when coding emails it’s so important to be aware of what the receipients are using to view the email. If you are sending to iphone users then fine. Be aware however these techniques will fail miserably in Outlook. The top of most of my clients’ requirements is for their emails to work reliably in as many situations as possible, including Outlook, which many people in offices use.

    Recently I carried out an analysis of how some similar techniques to those outlined here pan out in Outlook. The results can be viewed here – http://www.creativeglo.co.uk/blog/email-design/example-of-why-correct-coding-is-important-in-email-design/ There are links there to some other articles on solid, reliable coding for emails.

    It’s great to see what others are doing to push the boundaries. Keep the great articles comming.

  • http://ow.ly/1I8c2 lee

    thank you very much Ros Hodgekiss.

  • http://stevegrunwell.com Steve Grunwell

    My new goal is to live long enough to see CSS3 supported across all major email clients. At the rate email standards are going, that should keep me alive until at least 2420.

    • http://spotdex.com Davidmoreen

      I am just wondering if all of the email clients will support such great features…

  • http://www.karloespiritu.com/ Karlo Espiritu

    Very informative article. Great to know there are significant improvements for CSS3 in email. I’ve been using campaign monitor for many years now, and my main concern has always been the limited support for CSS. I always had to sacrifice the design of the templates I created to make the design compatible across email clients.

  • http://sonergonul.com/ Soner Gönül

    Wow

    Nice

    Thanks

  • http://99graphicdesigns.com charlotte

    Its a battle field out there for Developers, were hoping that one day, someone will decide enough is enough and institute some kind code law, where all browsers are enforced to follow.

    One resolution is developing a software program that can instictively separate each e-mail address and only send the email template thats coded correctly for that browser.

    For example all yahoo recipients would receive only yahoo coded e-mail content. There might already be a software out there that does this, however I have never heard of it. All this coding is very time consuming and you never konw if it paid off in the end.

    I personally enjoy designing but not so much the coding, I do get excited when I get naughty code to work when it clkearly shouldnt. always looking for the latest hacks.

    thats a perfect idea for your next post, Hacks, hacks and more hacks- got love it
    I don’t currently harass my site visitors with such things, I hate e-mails and prefer a more direct approach, I would rather someone comment on my blog than send me get an e-mail address.

  • http://www.goblinridge.co.uk Ted Thompson

    Great article, very informative.

  • http://www.iguama.com Comprar online

    Css3 is evolution but we must learn to properly implement.

  • http://emailwear.net Newsletter Templates
  • AntoxaGray

    People should stop using bad mail clients.

    I never read newsletters, by the way. I prefer RSS/blogs.

  • www

    hey there and thank you for your info – I have definitely picked up anything new from right here. I did however expertise several technical points using this web site, since I experienced to reload the website a lot of times previous to I could get it to load correctly. I had been wondering if your web host is OK? Not that I’m complaining, but sluggish loading instances times will very frequently affect your placement in google and could damage your quality score if advertising and marketing with Adwords. Well I am adding this RSS to my e-mail and can look out for much more of your respective fascinating content. Make sure you update this again soon..

  • http://emailmar.com vicomar

    Thank you very much. I will try design a email template for me

  • Al

    text-shadow does not work in gmail