2012-07-25 33 views
0

我已經搜索了每一個地方,爲什麼字體在Firefox中無法正常工作。我發現了幾個不同的答案,但似乎沒有解決這個問題。如果有人能給我一些很棒的提示。@ font-face不工作在Firefox上

CSS代碼:

@font-face 
{ 
    font-family:Viking-Normal; 
    src: url('../fonts/VIKING.eot') format("opentype"), url('../fonts/VIKING.ttf') format("truetype"); 
} 

div#header 
{ 
    font-family:Viking-Normal !important; 
    font-size:58px; 
    text-align:center; 
    width:780px; 
    height:150px; 
    background:#0078A8; 
    margin-left:auto; 
    margin-right:auto; 
} 

回答

1

這將有助於瞭解你已經嘗試過什麼,而是看你的代碼的三件事情浮現在腦海中:

  1. 字體家族名應該是之間是單引號或雙引號。

    例如,

    font-family: 'Viking-Normal'; 
    


  2. 到你的字體路徑可能是錯誤的,你可以通過將完整的URL路徑,直到它從瀏覽器直接訪問它?


  3. 您的瀏覽器支持可能已損壞或缺失的字體文件。我使用font squirrel to generate所需的CSS和字體文件。

    你只需要上傳你的字體文件,就會彈出一個包含你的字體的演示文件,一個css-ready文件和更好的跨瀏覽器支持所需的格式。

    例如,

    @font-face { 
        font-family: 'VikingRegular'; 
        src: url('viking-webfont.eot'); 
        src: url('viking-webfont.eot?#iefix') format('embedded-opentype'), 
         url('viking-webfont.woff') format('woff'), 
         url('viking-webfont.ttf') format('truetype'), 
         url('viking-webfont.svg#DearestRegular') format('svg'); 
        font-weight: normal; 
        font-style: normal; 
    } 
    
+0

感謝Zuul, 我修改了字體松鼠,我知道有工作在所有瀏覽器。 CSS: @ font-face { font-family:'VikingRegular'; src:url('../ fonts/VIKING.eot'); ('../ fonts/VIKING.eot?#iefix')格式('embedded-opentype'),url('../ fonts/VIKING.ttf')格式('truetype'),font-體重:正常; font-style:normal; } – 2012-07-25 01:49:11

+0

@MthethewBranch很高興能幫到你! :) – Zuul 2012-07-25 01:55:45