2017-02-22 53 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; 
 
}

相關問題