伪元素包含不适用于Font Awesome

时间:2018-08-16 13:46:20

标签: css font-face pseudo-element webfonts

编辑:此问题特定于Font Awesome的伪元素包含,<i class="fas fa-spray-can"></i>可以正常工作。

 #menu-item-3218 a:before{
    content:'\f5bd';
    font-family:'FontAwesome';
    display:inline-block!important;
    padding-right:6px;
    vertical-align:-5%;
    font-size:90%;
    font-weight:normal;
}

不起作用。

但是,为了扩大图的范围,伪元素包含确实适用于font-family: "fa5-brands",但不适用于font-family: "FontAwesome"

如您所见,字体图标不会为font-family: "FontAwesome"加载(显示框占位符),但会为font-family: "fa5-brands"(PS4图标等)和font-family: 'Rajdhani'(您看到的文字字体): enter image description here

我猜在Chrome开发者面板中,字体似乎正在加载吗?

enter image description here

CSS样式表的位置Location of CSS stylesheet

字体位置: Location of fonts

我在WordPress网站上的CSS样式表中的@ font-face实施中找不到任何错误。有人可以看到我看不到的错误吗?

CSS样式表中的相关内容

 @font-face {
     font-family: 'Rajdhani';
     src: url('./assets/fonts/Rajdhani/rajdhani-regular-webfont.svg#rajdhaniregular') format('svg'), url('./assets/fonts/Rajdhani/rajdhani-regular-webfont.woff') format('woff'), url('./assets/fonts/Rajdhani/rajdhani-regular-webfont.ttf') format('truetype');
     font-weight: normal;
     font-style: normal;
}
 @font-face {
     font-family: "fa5-brands";
     src: url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-brands-400.svg#fontawesome-free') format('svg'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-brands-400.woff2') format('woff2'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-brands-400.woff') format('woff'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-brands-400.ttf') format('truetype');
     font-weight: normal;
     font-style: normal;
}
 @font-face {
     font-family: "FontAwesome";
     src: url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-regular-400.svg#fontawesome-free') format('svg'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-regular-400.woff2') format('woff2'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-regular-400.woff') format('woff'), url('./assets/fonts/fontawesome-free-5-2-0-web/webfonts/fa-regular-400.ttf') format('truetype');
     font-weight: normal;
     font-style: normal;
}

0 个答案:

没有答案