Does @font-face work in email templates?
One gotcha is Cross-origin resource sharing (CORS). For at least Thunderbird you must make sure that the remote server (that hosts the font) sends a HTTP header like:
Access-Control-Allow-Origin: *
You can! But with all things cool in html-email it will not work in every client/browser.
@font-face
will work in iOS and (most of) Android's default clients, Apple Mail, and Outlook 2011 for Mac. Everything else either strips your whole <style>
tag or just ignores it.
Some precautions: font-face freaks out Outlook '07-'13, so wrap your font-face CSS in it's own style tag, in an MSO conditional. Make sure you use all types of font files in your @font-face
- otf, ttf, eot, svg so it works across browsers. Then make sure you have good fallbacks when you try and use it. At the least you should have font-family:'Custom Font',sans-serif;
(or serif).
<!--[if !mso]><!-->
<style type="text/css">
@font-face {
font-family: 'Custom-Font';
font-weight: 400;
font-style: normal;
src: url('http://somethingdoodad.biz/fonts/Custom-Font-Regular.svg#Customfont-Regular') format('svg'),
url('http://somethingdoodad.biz/fonts/Custom-Font-Regular.eot?#iefix') format('embedded-opentype'),
url('http://somethingdoodad.biz/fonts/Custom-Font-Regular.woff') format('woff'),
url('http://somethingdoodad.biz/fonts/Custom-Font-Regular.ttf') format('truetype');
}
</style>
<!--<![endif]-->