2015-08-26 75 views
0

http://www.chooseyourtelescope.com/字体家庭不字型工作

大“C”,在页面的中间,H1(“选择正确的......)应以‘Pirulen’FONT-FAMILY写。

我首先尝试了“经典”@ font-face方法,然后通过使用WEBFONT GENERATOR并添加在MyFonts文件夹中创建的所有文件。

CSS

@font-face { 
    font-family: 'pirulenregular'; 
    src: url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.eot'); 
    src: url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.eot?#iefix') format('embedded-opentype'), 
     url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.woff2') format('woff2'), 
     url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.woff') format('woff'), 
     url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.ttf') format('truetype'), 
     url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.svg#pirulenregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

但它仍然无法正常工作

回答

0

url需要为Web网址,而不是文件路径。你通常设置它相对的CSS文件的位置,所以这将是:

@font-face { 
    font-family: 'pirulenregular'; 
    src: url('MyFonts/pirulen_rg-webfont.eot'); 
    src: url('MyFonts/pirulen_rg-webfont.eot?#iefix') format('embedded-opentype'), 
    url('MyFonts/pirulen_rg-webfont.woff2') format('woff2'), 
    url('MyFonts/pirulen_rg-webfont.woff') format('woff'), 
    url('MyFonts/pirulen_rg-webfont.ttf') format('truetype'), 
    url('MyFonts/pirulen_rg-webfont.svg#pirulenregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

下一个问题是,在页面上指定的字体族为“pirulen”,但在CSS它是“ pirulenregular“,这些必须匹配,所以选择一个。

+0

啊是的我忘记了在CSS中改变'pirulenregular'的名字。但无论如何,我曾尝试过在页面+ CSS中使用pirulenregular,但它不起作用。 “文件路径”是问题。感谢它现在的工作;) – edou777