Credit to Cerberus
-
-
Save philcon93/b4dae04c42f7be380c23092523970fb9 to your computer and use it in GitHub Desktop.
Email CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Web Font / @font-face : BEGIN --> | |
<!-- NOTE: If web fonts are not required, lines 1 - 18 can be safely removed. --> | |
<!-- Desktop Outlook chokes on web font references and defaults to Times New Roman, so we force a safe fallback font. --> | |
<!--[if mso]> | |
<style> | |
* { | |
font-family: sans-serif !important; | |
} | |
</style> | |
<![endif]--> | |
<!-- All other clients get the webfont reference; some will render the font and others will silently fail to the fallbacks. More on that here: http://stylecampaign.com/blog/2015/02/webfont-support-in-email/ --> | |
<!--[if !mso]><!--> | |
<!-- insert web font reference, eg: <link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'> --> | |
<!--<![endif]--> | |
<!-- Web Font / @font-face : END --> | |
<!-- CSS Reset --> | |
<style> | |
/* 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 auto !important; | |
padding: 0 !important; | |
height: 100% !important; | |
width: 100% !important; | |
} | |
/* What it does: Stops email clients resizing small text. */ | |
* { | |
-ms-text-size-adjust: 100%; | |
-webkit-text-size-adjust: 100%; | |
} | |
/* What it does: Centers email on Android 4.4 */ | |
div[style*="margin: 16px 0"] { | |
margin:0 !important; | |
} | |
/* What it does: Stops Outlook from adding extra spacing to tables. */ | |
table, | |
td { | |
mso-table-lspace: 0pt !important; | |
mso-table-rspace: 0pt !important; | |
} | |
/* What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */ | |
table { | |
border-spacing: 0 !important; | |
border-collapse: collapse !important; | |
table-layout: fixed !important; | |
margin: 0 auto !important; | |
} | |
table table table { | |
table-layout: auto; | |
} | |
/* What it does: Uses a better rendering method when resizing images in IE. */ | |
img { | |
-ms-interpolation-mode:bicubic; | |
} | |
/* What it does: A work-around for email clients meddling in triggered links. */ | |
*[x-apple-data-detectors], /* iOS */ | |
.x-gmail-data-detectors, /* Gmail */ | |
.x-gmail-data-detectors *, | |
.aBn { | |
border-bottom: 0 !important; | |
cursor: default !important; | |
color: inherit !important; | |
text-decoration: none !important; | |
font-size: inherit !important; | |
font-family: inherit !important; | |
font-weight: inherit !important; | |
line-height: inherit !important; | |
} | |
/* What it does: Prevents Gmail from displaying an download button on large, non-linked images. */ | |
.a6S { | |
display: none !important; | |
opacity: 0.01 !important; | |
} | |
/* What it does: Prevents underlining the button text in Windows 10 */ | |
.button-link { | |
text-decoration: none !important; | |
} | |
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */ | |
/* Create one of these media queries for each additional viewport size you'd like to fix */ | |
/* Thanks to Eric Lepetit @ericlepetitsf) for help troubleshooting */ | |
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) { /* iPhone 6 and 6+ */ | |
.email-container { | |
min-width: 375px !important; | |
} | |
} | |
</style> | |
<!-- What it does: Makes background images in 72ppi Outlook render at correct size. --> | |
<!--[if gte mso 9]> | |
<xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> | |
</o:OfficeDocumentSettings> | |
</xml> | |
<![endif]--> | |
< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment