2013-03-05 50 views
2

我怎麼知道爲什麼字體沒有顯示?CSS:字體表面無法在Chrome上工作

我在Chrome中 - 所以.ttf應該可以工作。 我檢查了我可以導航到使用我的URL欄的文件,我可以下載它,所以權限很好。

我有一個頁面,聲明瞭一個@字體面:

@font-face { 
    font-family: 'entypo'; 
    src: url('/css/fonts/entypo.ttf') format('truetype'); 
    font-weight: normal; 
    font-style: normal; 
} 

p { font-family: 'entypo'; } 
+0

不錯。我這樣做了,我可以很好地下載字體文件。 – 2013-03-05 17:27:06

+0

按F12打開網絡檢查員。點擊「資源」標籤。展開「框架」,以及以頁面命名的文件夾。那裏有一個字體文件夾嗎?你的字體在那裏?現在打開「網絡」標籤。重新加載您的頁面。你的字體是否出現在列表中?像這樣的一些檢查可以更容易地找出問題所在。 – Barney 2013-03-05 17:27:31

+0

理論上,這*應該*起作用。 – SeinopSys 2013-03-05 17:28:20

回答

4

的@字體面不能是塊內。通常的做法是將它放在CSS文件的頂部。

您來源:

#lookgram { 
    @font-face { 
    font-family: 'entypo'; 
    src: url("/entypo.eot"); 
    src: url("/entypo.eot?#iefix") format("embedded-opentype"), url("/entypo.woff") format("woff"), url("/entypo.ttf") format("truetype"), url("/entypo.svg#entypo") format("svg"); 
    font-weight: normal; 
    font-style: normal; 
    } 

    @font-face { 
    font-family: 'entypo_social'; 
    font-style: normal; 
    font-weight: 400; 
    src: url("/css/fonts/entypo-social.woff") format("woff"); 
    } 

    margin: 0; 
    font-family: "Helvetica Neue", Helvetica, Arial, "lucida grande", tahoma, verdana, arial, sans-serif; 
}