Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

css - Can Outlook 2010 use a web font in an html email?

I've tried several things, including wrapping the css. Any ideas on how to get an html email Outlook 2010 to use a webfont and not default to a preinstalled font?

Here is some of the stuff I've tried:

    <style type="text/css">
    @font-face {
    font-family: 'thegirlnextdoor';
    src: url('http://www.mercerhrs.com/email/nordstrom/274257/font/thegirlnextdoor.eot'); /* IE9 Compat Modes */
    src: url('http://www.mercerhrs.com/email/nordstrom/274257/font/thegirlnextdoor.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */    url('http://www.mercerhrs.com/email/nordstrom/274257/font/thegirlnextdoor.woff') format('woff'), /* Modern Browsers */
     url('http://www.mercerhrs.com/email/nordstrom/274257/font/thegirlnextdoor.ttf')  format('truetype'), /* Safari, Android, iOS */
     url('http://www.mercerhrs.com/email/nordstrom/274257/font/thegirlnextdoor.svg') format('svg'); /* Legacy iOS */
}
</style>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The following technique does not require repetitive use of conditional comments. I have tested this extensively:

  1. Inline your web-safe font family as usual, but with an extra classname on the element. (If you're using an automatic CSS inliner, it's OK to specify your web-safe fonts with the rest of your CSS using the .webfont classname.)

    <td style="font-family: arial, sans-serif;" class="webfont">Text</td>
    
  2. In the <head>, override the web-safe font family with your webfont like so:

    <style type="text/css">
      @import url(http://mysuperjazzywebfont.com/webfont.css);
    
      @media screen { /* hides this rule from unsupported clients */ 
        .webfont {
           font-family: "Super Jazzy Webfont", arial, sans-serif !important;
        }
      }
    </style>
    

Note: wrapping the .webfont class in the simple @media screen query simply prevents Outlook 07, 10 and 13 from mistakenly using Times New Roman instead of your fallback fonts. Reference

These clients display the web font:

  • Apple Mail
  • iOS Mail
  • Android 4.2 Stock Mail Client
  • Lotus Notes 8
  • Outlook 2000
  • Outlook 2011
  • AOL Webmail (in browsers that support @media)

The following Outlook versions get Arial:

  • Outlook 2002
  • Outlook 2003
  • Outlook 2007 (instead of Times New Roman)
  • Outlook 2010 (instead of Times New Roman)
  • Outlook 2013 (instead of Times New Roman)

... and numerous other more predictable clients get Arial.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...