Skip to content

Instantly share code, notes, and snippets.

@cridenour
Created May 22, 2013 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cridenour/5625615 to your computer and use it in GitHub Desktop.
Save cridenour/5625615 to your computer and use it in GitHub Desktop.
Created from http://codepen.io/cridenour/pen/liaht - kept here for use later! The two columns turn into a single column for email clients that recognize media queries. For others they'll use the percentage widths or will show the regular 600px wide format. This framework has tested successfully in Gmail, Yahoo, Mac and PC Outlook, and works resp…
<body style="width:100%; margin:0; padding:0; -webkit-text-size-adjust:none; -ms-text-size-adjust:none; background-color:#ffffff;">
<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" style="height:auto !important; margin:0; padding:0; width:100% !important; background-color:#FFFFFF; color:#222222;">
<tr>
<td>
<div id="tablewrap" style="width:100% !important; max-width:600px !important; text-align:center; margin:0 auto;">
<table id="contenttable" width="600" align="center" cellpadding="0" cellspacing="0" border="0" style="background-color:#FFFFFF; margin:0 auto; text-align:center; border:none; width: 100% !important; max-width:600px !important;">
<tr>
<td width="100%">
<table bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="100%" bgcolor="#ffffff" style="text-align:center;"><a href="#"><img src="http://placekitten.com/600/200" alt="Main banner image and link" style="display:inline-block; max-width:100% !important; width:100% !important; height:auto !important;border-bottom-right-radius:8px;border-bottom-left-radius:8px;" border="0"></a>
</td>
</tr>
</table>
<table bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="25" width="100%">
<tr>
<td width="100%" bgcolor="#ffffff" style="text-align:left;">
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:15px; line-height:19px; margin-top:0; margin-bottom:20px; padding:0; font-weight:normal;">
Dear Jane Smith,
</p>
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:15px; line-height:19px; margin-top:0; margin-bottom:20px; padding:0; font-weight:normal;">
Bacon ipsum dolor sit amet leberkas pork chop bacon doner venison hamburger pastrami bresaola short ribs filet mignon ham prosciutto, <a style="color:#2489B3; font-weight:bold; text-decoration:underline;" href="#">call to action</a>!
</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="emailwrapto100pc">
<tr>
<td class="emailcolsplit" align="left" valign="top" width="58%">
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:15px; line-height:19px; margin-top:0; margin-bottom:20px; padding:0; font-weight:normal;">
Swine pork salami, beef ribs doner pastrami fatback. Bacon ipsum dolor sit amet leberkas pork chop bacon doner venison hamburger pastrami bresaola short ribs filet mignon ham prosciutto salami tri-tip. Turducken pork pancetta meatloaf venison. Spare ribs tongue drumstick pastrami frankfurter brisket shoulder. Ground round capicola filet mignon chicken cow boudin venison bacon. </p>
</td>
<td class="emailcolsplit" align="left" valign="top" width="42%" style="padding-left:17px;max-width:231px;">
<a href="#"><img src="http://placekitten.com/305/255" alt="Supporting image 1" style="display:block; width:100% !important; height:auto !important;border-radius:8px;" border="0"></a>
</td>
</tr>
<tr>
<td class="emailcolsplit" align="left" valign="top" width="58%">
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:15px; line-height:19px; margin-top:0; margin-bottom:20px; padding:0; font-weight:normal;">
Ham hock pork chop jerky, turducken kielbasa meatball sausage drumstick bacon fatback corned beef meatloaf pork belly rump. Boudin cow hamburger ball tip chuck rump meatball. Andouille tenderloin flank, strip steak pork loin biltong swine turducken rump pork belly ball tip jowl. Hamburger tail short loin jerky doner venison rump ham ground round pork chop turkey fatback prosciutto.
</p>
</td>
<td class="emailcolsplit" align="left" valign="top" width="42%" style="padding-left:17px;max-width:231px;">
<a href="#"><img src="http://placekitten.com/305/245" alt="Supporting image 2" style="display:block; width:100% !important; height:auto !important;border-radius:8px;" border="0"></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="100%" bgcolor="#ffffff" style="text-align:center;"><a style="font-weight:bold; text-decoration:none;" href="#"><div style="display:block; max-width:100% !important; width:93% !important; height:auto !important;background-color:#2489B3;padding-top:15px;padding-right:15px;padding-bottom:15px;padding-left:15px;border-radius:8px;color:#ffffff;font-size:24px;font-family:Arial, Helvetica, sans-serif;">Call-To-Action Image or Text!</div></a></td>
</tr>
</table>
<table bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="25" width="100%">
<tr>
<td width="100%" bgcolor="#ffffff" style="text-align:left;">
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:11px; line-height:14px; margin-top:0; margin-bottom:15px; padding:0; font-weight:normal;">
Email not displaying correctly? <a style="color:#2489B3; font-weight:bold; text-decoration:underline;" href="#">View it in your browser.</a>
</p>
<p style="color:#222222; font-family:Arial, Helvetica, sans-serif; font-size:11px; line-height:14px; margin-top:0; margin-bottom:15px; padding:0; font-weight:normal;">
Copyright 2013 Your Company. All Rights Reserved.<br>
If you no longer wish to receive emails from us, you may <a style="color:#2489B3; font-weight:normal; text-decoration:underline;" href="#">unsubscribe</a>.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
/* PUT ALL CSS IN THE EMAIL <HEAD>
These styles are meant for clients that recognize CSS in the <head>; the email will still work for those that don't. */
#outlook a{padding:0;}
body{width:100% !important; background-color:#ffffff;-webkit-text-size-adjust:none; -ms-text-size-adjust:none;margin:0; padding:0;}
.ReadMsgBody{width:100%;}
.ExternalClass{width:100%;}
ol li {margin-bottom:15px;}
img{height:auto; line-height:100%; outline:none; text-decoration:none;}
#backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}
p {margin: 1em 0;}
h1, h2, h3, h4, h5, h6 {color:#222222 !important; font-family:Arial, Helvetica, sans-serif; line-height: 100% !important;}
table td {border-collapse:collapse;}
.yshortcuts, .yshortcuts a, .yshortcuts a:link,.yshortcuts a:visited, .yshortcuts a:hover, .yshortcuts a span { color: black; text-decoration: none !important; border-bottom: none !important; background: none !important;}
.im {color:black;}
div[id="tablewrap"] {
width:100%;
max-width:600px!important;
}
table[class="fulltable"], td[class="fulltd"] {
max-width:100% !important;
width:100% !important;
height:auto !important;
}
@media only screen and (max-width: 430px) {
td[class=emailcolsplit]{
width:100%!important;
float:left!important;
padding-left:0!important;
max-width:430px !important;
}
td[class=emailcolsplit] img {
margin-bottom:20px !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment