How to import custom fonts in HTML mailers (HTML Email) -
i working html mailers (html email) , design received contains custom fonts. how can use custom fonts in html email?
thanks in advance.
first , foremost, web fonts supported in these email clients:
- aol mail
- native android mail app (not gmail app)
- apple mail
- ios mail
- outlook 2000
- outlook.com
(eg. there's no way display custom web font in gmail web, yahoo, or newer versions of windows outlook)
step 1: if font hosted on service google fonts, can referenced there in html's <head>
section so:
<!-- desktop outlook chokes on web font references , defaults times new roman, force safe fallback font. --> <!--[if mso]> <style> * { font-family: sans-serif !important; } </style> <![endif]--> <!-- other clients webfont reference; render font , others silently fail fallbacks. --> <!--[if !mso]><!--> <link href='https://fonts.googleapis.com/css?family=roboto:400,700' rel='stylesheet' type='text/css'> <!--<![endif]-->
alternatively can use @import method.
<style> @media screen { @import url('https://fonts.googleapis.com/css?family=roboto'); } </style>
outlook doesn't support web fonts , choke on reference, wrapping in @media
tag make outlook ignore together.
if font not available online have font file, can converted web font using tool font squirrel. resulting files can uploaded server , referenced so:
@media screen { @font-face { font-family: {font-name}; src: url({http://www.website.com/font-url}) format('woff'), url({http://www.website.com/font-url}) format('truetype'); font-weight: normal; font-style: normal; } }
note: deep dive on how reference web fonts in email, check out this article litmus.
step 2: there, referencing web font in font stack display in email clients support web fonts.
font-family: 'roboto', 'fallback font 1', 'fallback font 2', sans-serif;
email clients no support web fonts (such gmail web, yahoo, or newer versions of windows outlook) skip on custom font , attempt display fallback fonts listed in font stack.
Comments
Post a Comment