cerberus-email
Version:
A few simple, but solid patterns for responsive HTML email templates and newsletters. Even in Outlook and Gmail.
278 lines (249 loc) • 12.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
<title></title> <!-- The title tag shows in email notifications, like Android 4.4. -->
<style type="text/css">
/* What it does: Remove spaces around the email design added by some email clients. */
/* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
html,
body {
margin: 0;
padding: 0;
height: 100% ;
width: 100% ;
}
/* What it does: Stops email clients resizing small text. */
* {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
/* What it does: Forces Outlook.com to display emails full width. */
.ExternalClass {
width: 100%;
}
/* What it does: Stops Outlook from adding extra spacing to tables. */
table,
td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
/* What it does: Fixes webkit padding issue. */
table {
border-spacing:0 ;
}
/* What it does: Fixes Outlook.com line height. */
.ExternalClass,
.ExternalClass * {
line-height: 100%;
}
/* What it does: Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */
table {
border-collapse: collapse;
margin: 0 auto;
}
/* What it does: Uses a better rendering method when resizing images in IE. */
img {
-ms-interpolation-mode:bicubic;
}
/* What it does: Overrides styles added when Yahoo's auto-senses a link. */
.yshortcuts a {
border-bottom: none ;
}
/* What it does: Overrides blue, underlined links auto-detected by iOS Mail. */
/* More Info: https://litmus.com/blog/update-banning-blue-links-on-ios-devices */
.mobile-link--footer a {
color: #666666 ;
}
/* What it does: Overrides styles added images. */
img {
border:0 ;
outline:none ;
text-decoration:none ;
}
/* What it does: Apple Mail doesn't support max-width, so a media query constrains the email container width. */
@media only screen and (min-width: 601px) {
.email-container {
width: 600px ;
}
}
/* What it does: Apple Mail doesn't support max-width, so a media query constrains the email container width. */
@media only screen and (max-width: 600px) {
.email-container {
width: 100% ;
max-width: none ;
}
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#222222" style="margin:0; padding:0; -webkit-text-size-adjust:none; -ms-text-size-adjust:none;">
<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%" bgcolor="#222222" style="border-collapse:collapse;"><tr><td>
<!-- Visually Hidden Preheader Text : BEGIN -->
<div style="display:none;font-size:1px;color:#222222;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide: all;">
(Optional) This text will appear in the inbox preview, but not the email body.
</div>
<!-- Visually Hidden Preheader Text : END -->
<!-- Outlook and Lotus Notes don't support max-width but are always on desktop, so we can enforce a wide, fixed width view. -->
<!-- Beginning of Outlook-specific wrapper : BEGIN -->
<!--[if (gte mso 9)|(IE)]>
<table width="600" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<![endif]-->
<!-- Beginning of Outlook-specific wrapper : END -->
<!-- Email wrapper : BEGIN -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" style="max-width:600px; margin:auto;" class="email-container">
<tr>
<td>
<!-- Logo + Links : BEGIN -->
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" style="padding:10px 0; text-align:left;" width="150">
<img src="http://placehold.it/150x50" alt="alt text" width="150" height="50" border="0" align="left">
</td>
<td valign="middle" style="padding:10px 0; text-align:right; line-height:1.1; font-family: sans-serif; font-size: 13px; color: #999999;">
A mobile-friendly template with no media queries.
</td>
</tr>
</table>
<!-- Logo + Links : END -->
<!-- Main Email Body : BEGIN -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<!-- Single Fluid Image, No Crop : BEGIN -->
<tr>
<td valign="middle" align="center" style="padding-top:4%;">
<img src="http://placehold.it/320" alt="alt text" height="320" width="320" align="center" border="0" style="margin: auto;">
</td>
</tr>
<!-- Single Fluid Image, No Crop : END -->
<!-- Full Width, Fluid Column : BEGIN -->
<tr>
<td style="padding: 4%; font-family: sans-serif; font-size: 18px; line-height: 1.3; color: #666666;">
Ulla nec est tristique, tempor lacus eu, aliquam erat. Cras tristique, arcu ac tristique hendrerit, urna diam mollis libero, vitae gravida nisi lectus in leo. Aenean eu ligula id nisi euismod dapibus et eu mauris. Donec quis dictum velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
</td>
</tr>
<!-- Full Width, Fluid Column : END -->
<!-- 2 x 2 grid : BEGIN -->
<tr>
<td>
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="4%" style="font-size: 0;line-height: 0;"> </td>
<td valign="top" width="44%" style="padding: 4% 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #666666; text-align: center;">
<img src="http://placehold.it/160" alt="alt text" height="160" width="160" border="0" align="center">
<br><br>
Mauris urna nibh, dictum quis sollicitudin a, placerat eu ipsum.
<br><br>
<table cellspacing="0" cellpadding="0" border="0" align="center" class="button" style="margin: auto;">
<tr>
<td style="border-radius: 3px; background: #222222; text-align: center;">
<a href="http://www.google.com" style="background: #222222; border: 15px solid #222222; padding: 0 10px;color: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 1; text-align: center; text-decoration: none; display: block; border-radius: 3px;">
<b><!--[if mso]> <![endif]-->A Button<!--[if mso]> <![endif]--></b>
</a>
</td>
</tr>
</table>
</td>
<td width="4%" style="font-size: 0;line-height: 0;"> </td>
<td valign="top" width="44%" style="padding: 4% 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #666666; text-align: center;">
<img src="http://placehold.it/160" alt="alt text" height="160" width="160" border="0" align="center">
<br><br>
Mauris urna nibh, dictum quis sollicitudin a, placerat eu ipsum.
<br><br>
<table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" class="button">
<tr>
<td style="border-radius: 3px; background: #222222; text-align: center;">
<a href="http://www.google.com" style="background: #222222; border: 15px solid #222222; color: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 1; text-align: center; text-decoration: none; display: block; border-radius: 3px;">
<b>A Full Width Button</b>
</a>
</td>
</tr>
</table>
</td>
<td width="4%" style="font-size: 0;line-height: 0;"> </td>
</tr>
</table>
</td>
</tr>
<!-- 2 x 2 grid : END -->
<!-- Data Table : BEGIN -->
<tr>
<td style="padding: 4%;">
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="">
<tr>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; font-weight: bold; border-bottom: 1px solid #cccccc">
Name
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; font-weight: bold; border-bottom: 1px solid #cccccc">
Date
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; font-weight: bold; border-bottom: 1px solid #cccccc">
Location
</td>
</tr>
<tr>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
Event Name
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
1-Jan-2014
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
New York, NY
</td>
</tr>
<tr>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
Another Name
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
8-Jul-2014
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
Phoenix, AZ
</td>
</tr>
<tr>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
A Third Name
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
21-Dec-2014
</td>
<td valign="top" align="left" style="padding: 10px 0; font-family: sans-serif; font-size: 15px; line-height: 1.3; color: #333333; border-bottom: 1px solid #eeeeee">
Seattle, WA
</td>
</tr>
</table>
</td>
</tr>
<!-- Data Table : END -->
</table>
<!-- Main Email Body : END -->
</td>
</tr>
<!-- Footer : BEGIN -->
<tr>
<td style="text-align:center; padding:4% 0; font-family:sans-serif; font-size:13px; line-height:1.2; color:#666666;">
You received this email because you opted in to our newsletter.
<br><br>
Company Name • <span class="mobile-link--footer">23 Fake Street, SpringField, Oregon 97477 US</span> • <span class="mobile-link--footer">(123) 456-7890</span>
<br><br>
<unsubscribe style="color:#666666; text-decoration:underline;">unsubscribe</unsubscribe>
</td>
</tr>
<!-- Footer : END -->
</table>
<!-- Email wrapper : END -->
<!-- End of Outlook-specific wrapper : BEGIN -->
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
<!-- End of Outlook-specific wrapper : END -->
</td></tr></table>
</body>
</html>