2011-04-07 34 views
1

你好社区!@ font-face问题

我目前在我们自己公司的网站上工作,我似乎无法得到@ font-face正常工作。 这是CSS的样子:

@font-face { 
    font-family: 'BebasNeue'; 
    src: url('type/BebasNeue-webfont.eot?') format('eot'), 
     url('type/BebasNeue-webfont.woff') format('woff'), 
     url('type/BebasNeue-webfont.ttf') format('truetype'), 
     url('type/BebasNeue-webfont.svg#webfontj1CI1MAi') format('svg'); 
} 

#nav li { 
    display: inline; 
    margin-left: 20px; 
    font-family: BebasNeue, Impact; 
    font-size: 24px; 
    color: #333333; 
    letter-spacing: 1pt; 
    } 

的@字体面的进口基本上是直接从字体松鼠@字体面发生器。我还没有发现什么是错的,这就是为什么我伸出手。 我编辑了字体名称和字体的位置(../type/)。

任何帮助表示赞赏,告诉我是否需要查看任何其他可能与此问题相关的代码。 干杯。

+0

你使用什么浏览器? – 2011-04-07 19:38:32

+0

不确定,但应该在eot字体的文件名中有问号吗? – 2011-04-07 19:46:34

+0

您是否尝试将单引号添加到'BebasNeue'?在#nav li {font-family:'BebasNeue',Impact;}至少这就是我如何使用它 – omabena 2011-04-07 19:48:38

回答

0

这些类型的问题不能总是在没有URL的情况下回答。语法看起来很好,但你可能有其他问题。例如,您是否使用IIS?您是否使用过IE9的开发工具来查看字体是否正在加载?

1

据我所知,这是贯彻落实@字体面临的最普遍的方式:

@font-face{ 
    /* for IE only (IE doesn't apear to comprehand normal CSS)*/ 
    font-family: "my fancy font"; 
    src: url("/fonts/font.eot"); 
} 

@font-face{ 
    /* for non CSS-challenged browsers */ 
    font-family: "my fancy font"; 
    src: local("☼"), 
     url("/fonts/font.eot") format('eot'), 
     url("/fonts/font.woff") format('woff'), 
     url("/fonts/font.otf") format('otf'), 
     url("/fonts/font.ttf") format('truetype'), 
     url("/fonts/font.svg") format('svg'); 
} 

两个@字体面段和东西不可能是在SRC文件名:本地()