2011-10-05 67 views
0

我試圖使用@font-face,但我並不是非常成功。 到現在爲止,我一直在使用谷歌的字體:無法獲得字體工作

// HTML header 
<link href='http://fonts.googleapis.com/css?family=Cuprum' rel='stylesheet' type='text/css'> 

//CSS 
#leftSection nav { 
    font-family: "Cuprum", Verdana, Arial, sans-serif; 
} 

然後我下載的字體和使用font-face嘗試:

這是我的CSS:

@font-face { 
    font-family: 'Cuprum'; 
    font-weight: normal; 
    font-style: normal; 
    font-size: 0.5em; 
    src: url('cuprum.eot?') format('eot'), 
     url('cuprum.woff') format('woff'), 
     url('cuprum.ttf') format('truetype'), 
     url('cuprum.svg#Cuprum') format('svg'); 
} 


#leftSection nav { 
    font-family: "Cuprum", Verdana, Arial, sans-serif; 
} 

的字體位於與CSS相同的文件夾中。

我已經看過,並測試過其他解決方案,但我仍然無法獲得它。

我與以下瀏覽器測試:FF7,IE8

更新
我添加font-size: 0.5em;這至少應該更改字體大小。但那也沒有發生。所以我猜想整個@font-face被忽略。

+0

你的頭文件中有鏈接到你的CSS文件嗎?您在那裏的鏈接僅限於Google Font API。 – chris5marsh

+0

是的,CSS文件加載正常。 – Steven

回答

2

你嘗試過使用字體松鼠生成器嗎?只要上傳字體,它會爲你做所有事情,這很簡單。

這裏是鏈接: http://www.fontsquirrel.com/fontface/generator

+0

這就是我第一次獲得字體的地方:) – Steven

+0

FontSquirrel非常棒 - 它可以爲您提供所有您需要的CSS。它還附帶示例代碼,並將字體轉換爲您需要的所有類型 - SVG,WOFF,EOT和TTF。 – chris5marsh

+0

我知道。我使用示例CSS進行測試,但仍得到相同的結果。 – Steven

0

我想你可以嘗試沒有圍繞"Cuprum"引號。

#leftSection nav { 
    font-family: Cuprum, Verdana, Arial, sans-serif; 
} 

此外,如果您/用戶在本地安裝了該字體,有時會出現問題。

爲了解決這個問題,你可以設置一個假的local參考。

Paul Irish's Bulletproof @font-face syntax

編輯

兩個其他的事情你可以嘗試:

  1. 變化的字體名稱爲小寫,cuprum

  2. 取下聲明如下:

    font-weight: normal; 
    font-style: normal; 
    font-size: 0.5em; 
    
+0

傑森熱納羅,我已經嘗試沒有報價,以及,仍然無法正常工作。 – Steven

+0

我已經提出了更多建議@Steven。看看那些幫助。 –

+0

不好,同樣的結果:( – Steven

1

嘿史蒂芬,你這個做什麼? 爲什麼不試試這個。

插入這個你的CSS裏面:

@font-face { 
font-family: 'Cuprum'; 
font-style: normal; 
font-weight: normal; 
src: local('Cuprum'), url('http://themes.googleusercontent.com/static/fonts/cuprum/v1/sp1_LTSOMWWV0K5VTuZzvQ.woff') format('woff'); 
} 

#leftSection nav { 
font-family: Cuprum, Verdana, Arial, sans-serif; 
} 

我希望它會工作。 :)