On Github jennz0r / 1999
Civil Engineer
Once upon a time, I was civil engineer!But I quickly became bored with the slow pace of projects."Community Specialist" at "Startup"
Read: customer support.
I wanted to be part of the Tech industry, so I started working as a "Community Specialist" for a "startup".So I taught myself to code.
I landed my first job as a Web Developer!
Redesign emails and make them mobile-friendly.
The first victim was our Welcome email.
Naturally, I researched other Welcome emails.
Signed up for services and scoured my personal email for examples of good and/or bad email designs.A lot of it is pretty instinctual, but eventually I could pinpoint the highs and lows.I know, I know, these are not welcome emails.
But they're just so pretty!
May not work for everyone
A/B Test the hell out of your emails
Testing the mobile waters
Reliable rendering across clients and devices
Teams with limited resources
Simple layouts
Emails with mostly text that can flow
Teams with limited resources
Large mobile audiences
The most control over layout
Teams with knowledge of media queries
We used them all.
There are a LOT of options...
which I'll mention a bit later
... and which I didn't use.
Minimum Touchable Area44px by 44px
Smashing Magazine: Touchscreen Target Sizes
Puget Works: Minimum Touchable Areas
Velocity vs JavaServer Page (JSP)
are coming.
Not adding an outer <table> makes your code disappear in Apple Mail and Outlook 2011
do not display as inline or block
<table> default is display:table;
Use display:block; or Chrome will ignore max-width!
Gmail doesn't support <style> in <head>
Outlook.com doesn't support link in <head>
Many clients don't support a whole bevy of CSS!
See Campaign Monitor CSS page.
You will, unfortunately, be doing a lot of this:
<table cellpadding="0" cellspacing="0" border="0" align="center" width=" 95%" style="margin: 15px auto 10px auto; border: 1px solid #72b6e6; background-color: #f3f7f9;"> <tbody><tr> <td style="padding: 10px;"> <span style="font-size: 0.9em; line-height: 1.0em;"> From: <strong>${userName}</strong> <a href="mailto:${userEmail}" style=" color: #47c7b5; font-weight: bold;"><${userEmail}></a> </span> </td> </tr> </tbody></table>
<%--Wrapper Table Begin--%> <table cellpadding="0" cellspacing="0" border="0" width="100%" id=" backgroundTable" style="display: block; max-width: 600px; margin: 0 auto;"> </table> <%--Wrapper Table End--%>
Tables all the way down.
Always have alt=" " or a background color.
This is also great for accessibility!
<img src="http://files.hotpads.com/images/email/hotpads_logo_email.png " width="130px" alt="HotPads Logo" style="border:none">
<img src="http://filenet.hotpads.com/images/email/footer.jpg" class=" footerImage" style="width:100%; background-color:#71B5E6;">
Check it out on Github
Awesome for readability or targetting devices!
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { #backgroundTable { max-width: 600px; } }
Note: Media queries don't work on all clients.
Style Campaign's Guide to Responsive Email Support
Target Apple devices with 480px
@media only screen and (max-width: 480px), (max-device-width: 480px) { // Small screen styles here }
Use in conjunction with fluid layouts (% based widths)
@media only screen and (max-width: 480px), (max-device-width: 480px) { #backgroundTable { max-width: 480px; font-size: 18px; margin: 0px; } }
<table width="100%"> </table>
From Stack Overflow
Target retina or high res devices
@media all and (min-device-pixel-ratio : 1.5), all and (-webkit-min-device-pixel-ratio: 1.5) { // Retina device styles go here! }
When to use?
Sometimes inline styles overwrite media queries...
@media only screen and (max-width: 480px), (max-device-width: 480px) { .headerBar { height: 5px !important; line-height: 5px !important; } }
<table> <tbody><tr> <td colspan="3" class="headerBar" style=" height: 10px; line-height: 10px;"> <span>Blah blah blah</span> </td> </tr> </tbody></table>
Set a line-height on the surrounding <td>
Super weird and only occurs occasionally.
<span class="playBadge"> <a href="http://hotpads.com/referral.htm"><img src="http://filenet.hotpads.com/images/email/android_badge_100px.png" alt="HotPads Android App" class="mobileBadge"></a> </span>
VS.
<span class="playBadge"> <a href="http://hotpads.com/referral.htm"> <img src="http://filenet.hotpads.com/images/email/android_badge_100px.png" alt="HotPads Android App" class="mobileBadge"> </a> </span>
Outlook 2007, 2010, 2013, and Outlook in IE don't allow HTML or CSS image sizing. Argh.
Replace <img> by setting a background-image style on the surrounding <td> and assigning display: none; on the <img>.
@media all and (min-device-pixel-ratio : 1.5), all and (-webkit-min-device-pixel-ratio: 1.5) { td[class="cautionBar"] { background-image: url('http://filenet.hotpads.com/images/email/warning.png'); background-position: center; background-size: 30px 30px; background-repeat: no-repeat; width: 30px; !important; height: 30px; !important; } td[class="cautionBar"] img { display: none; } }
<table> <tbody><tr> <td valign="middle" class="cautionBar"> <img src="http://filenet.hotpads.com/images/email/warning_30px.png" width="30px" height="30px" style="float: left; padding-left: 5px;"> </td> </tr> </tbody></table>
ignore max-width.
#backgroundTable { margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; } @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { #backgroundTable { width: 600px; } }
Style Campaign Max Width Bypass
Ignores <a> color styles in the <head>.
You have to style each and every <a> inline.