Css 字体系列不能使用字体面

Css 字体系列不能使用字体面,css,fonts,font-face,Css,Fonts,Font Face,页面中间的大“C”和H1('选择右边…)应使用“Pirulen”字体系列书写 我首先尝试了“classic”@font-face方法,然后是advenced方法,使用WEBFONT生成器并添加在MyFonts文件夹中创建的所有文件 CSS @font-face { font-family: 'pirulenregular'; src: url('/www/wp-content/themes/virtue - child/MyFonts/pirulen_rg-webfont.eot

页面中间的大“C”和H1('选择右边…)应使用“Pirulen”字体系列书写

我首先尝试了“classic”@font-face方法,然后是advenced方法,使用WEBFONT生成器并添加在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;
}

但是它仍然不起作用

您的
url
需要是一个web 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”,这些必须匹配,所以选择一个。

啊,是的,我忘记了更改CSS中的“pirulenregular”名称。但不管怎样,我以前尝试过在page+CSS中使用pirulenregular,但没有成功。“文件路径”是问题所在。谢谢,现在可以工作了;)