2017-02-22 104 views
0

目前我正在使用hmtl和css w/bootstrap的第一个项目。到目前为止,事情进展得很顺利。但是现在我遇到了在我的网页上添加自定义字体的问题。我搜索了如何做到这一点,但@ font-face并没有真正的工作。我的老师在课堂上进行了修正,所以应该有可能我只是不知道他是如何完成的,而且他没有给出代码。我做了下:@ font-face只适用于IE,不适用于chrome

@font-face { 
 
\t font-family: 'Impact Label'; 
 
\t src: url('ImpactLabel.eot'); 
 
\t src: url('ImpactLabel.eot?#iefix') format('embedded-opentype'), 
 
\t \t url('ImpactLabel.ttf') format('truetype'), 
 
\t \t url('ImpactLabel.woff') format('woff') 
 

 
\t font-weight: normal; 
 
\t font-style: normal; 
 
}

我看到铬支持WOFF所以我不明白为什么它无法在Chrome工作,它在IE工作虽然。我的H1看起来就像这样:

h1 
 
{ 
 
\t font-family: 'Impact Label'; 
 
}

任何帮助是值得欢迎的。链接到网站是here

+1

在你的榜样,一个分号后'( 'WOFF')'丢失。这可能是原因吗? –

+0

我怎么能看不到... 它现在的作品,非常感谢你! –

回答

1

你错过了最后一个src属性后的分号。该代码应阅读:

@font-face { 
 
\t font-family: 'Impact Label'; 
 
\t src: url('ImpactLabel.eot'); 
 
\t src: url('ImpactLabel.eot?#iefix') format('embedded-opentype'), 
 
\t \t url('ImpactLabel.ttf') format('truetype'), 
 
\t \t url('ImpactLabel.woff') format('woff'); 
 

 
\t font-weight: normal; 
 
\t font-style: normal; 
 
}

相关问题