Civil Engineer
"Community Specialist" at "Startup"
Read: customer support.
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.
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
Litmus Article
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 Area
44px by 44px
Velocity vs JavaServer Page (JSP)
are coming.
"Note: Prior to the creation of CSS, HTML <table> elements were often used as a method for page layout. This usage has been discouraged since HTML 4, and the <table> element should not be used for layout purposes."
"LOL"
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:
From: ${userName}
<${userEmail}>
<%--Wrapper Table Begin--%>
<%--Wrapper Table End--%>
Tables all the way down.
Always have alt=" " or a background color.
This is also great for accessibility!
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.
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;
}
}
"The device pixel ratio is the ratio between logical pixels and physical pixels."
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;
}
}
Blah blah blah
Set a line-height on the surrounding <td>
Super weird and only occurs occasionally.
VS.
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;
}
}
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;
}
}
Ignores <a> color styles in the <head>.
You have to style each and every <a> inline.