字体系列不使用字体

时间:2015-08-26 01:50:48

标签: css fonts font-face

http://www.chooseyourtelescope.com/

页面中间的大“C”和H1(“选择正确...”)应该用“Pirulen”字体系列写。

我首先尝试使用“经典”@ 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;
}

但它仍然不起作用

1 个答案:

答案 0 :(得分:0)

您的url需要是网址,而不是文件路径。您通常将其设置为相对于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",这些必须匹配,所以选择一个。