Skip to content

Instantly share code, notes, and snippets.


alisonmonteiro/email-boilerplate.html Secret

Last active Mar 17, 2020
What would you like to do?
email-boilerplate (baseado nos e-mails do ifood)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Your title here!</title>
<style type="text/css">
Originally based on The MailChimp Reset from Fabio Carneiro, MailChimp User Experience Design
More info and templates on Github: &amp;
/* Client-specific Styles */
#outlook a {padding: 0;} /* Force Outlook to provide a "view in browser" menu link. */
body{font-family: Arial, sans-serif; font-size: 14px; width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;}
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
.ExternalClass {width: 100%;} /* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing. More on that: */
#backgroundTable {margin: 0; padding: 0; width: 100% !important; line-height: 100% !important; background: #F6F4F5;}
/* End reset */
/* Some sensible defaults for images
1. "-ms-interpolation-mode: bicubic" works to help ie properly resize images in IE. (if you are resizing them using the width and height attributes)
2. "border:none" removes border when linking images.
3. Updated the common Gmail/Hotmail image display fix: Gmail and Hotmail unwantedly adds in an extra space below images when using non IE browsers. You may not always want all of your images to be block elements. Apply the "image_fix" class to any image you need to fix.
Bring inline: Yes.
img {outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}
a img {border: none;}
.image_fix {display: block;}
/** Yahoo paragraph fix: removes the proper spacing or the paragraph (p) tag. To correct we set the top/bottom margin to 1em in the head of the document. Simple fix with little effect on other styling. NOTE: It is also common to use two breaks instead of the paragraph tag but I think this way is cleaner and more semantic. NOTE: This example recommends 1em. More info on setting web defaults: or
Bring inline: Yes.
p {margin: 16px 0;}
/** Hotmail header color reset: Hotmail replaces your header color styles with a green color on H2, H3, H4, H5, and H6 tags. In this example, the color is reset to black for a non-linked header, blue for a linked header, red for an active header (limited support), and purple for a visited header (limited support). Replace with your choice of color. The !important is really what is overriding Hotmail's styling. Hotmail also sets the H1 and H2 tags to the same size.
Bring inline: Yes.
h1, h2, h3, h4, h5, h6,
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active,
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
color: #000 !important; /* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients, this was added just for good measure. */
/** Outlook 07, 10 Padding issue: These "newer" versions of Outlook add some padding around table cells potentially throwing off your perfectly pixeled table. The issue can cause added space and also throw off borders completely. Use this fix in your header or inline to safely fix your table woes.
More info:
H/T @edmelly
Bring inline: No.
table td {border-collapse: collapse;}
/** Remove spacing around Outlook 07, 10 tables
More info :
Bring inline: Yes
table {border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;}
/* MY CSS */
.wrapper {max-width: 600px;}
Use @media queries with care.
You should not bring these styles inline -- so it's recommended to apply them AFTER you bring the other stlying inline.
@media only screen and (max-device-width: 500px) {
<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
<table cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
<!-- End of wrapper table -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment