css - 字体系列不适用于字体

标签 css fonts font-face

http://www.chooseyourtelescope.com/

页面中间的大“C”和 H1('Choose The Right...)应使用“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;
}

但是还是不行

最佳答案

您的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 - 字体系列不适用于字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32216763/

相关文章:

javascript - 为区域构建具有可选和不同背景(颜色和图像填充)的复杂图像映射

css - 如何在@media 查询上移动导航?

css - 垂直对齐不起作用

html - IE Intranet 兼容性 View 不包括某些字体

css - 字体显示不统一

html - 使用 css 裁剪和居中图像

css - @font-face 不知何故不起作用

css - @font-face 修复了 IE 9 及更高版本,但在 IE 8 中引入了新问题

css - 在 Chrome 中使用 font-face 时出现奇怪的字长问题

html - 谷歌浏览器首次访问时不会显示字体(css3、html5)。 (仅在刷新时)