使用CSS更改字体Awesome图标不起作用

我们想在整个网页的WordPress主题中修改一个Awesome Font图标。 主题是使用框架(bebel)构建的,我们不知道如何修改HTML以更改代码中的类,因为此外它还使用VisualComposer作为自定义框。</ p>

然后 我们想用css更改图标,我将选择添加我的主题的额外css,并且我提出以下规则:</ p>

CSS输入:
</ p>

  .fa-location-arrow :: before {
font-family:FontAwesome;
content:“\ f041”!important;
}
</ code> </ pre>

更改不适用,在chrome中脉冲F12并检查图标。 CSS规则如下所示。</ p>

CSS输出:
</ p>

  .fa-location-arrow :: before {
Font -family:FontAwesome;
内容:\“\ f041 \”!important;
}
</ code> </ pre>

CSS输出图像:</ p>
\ n

</ p>

是否可能 在保存css时,主题是以某种特殊方式在php中处理的? 谁知道为什么会发生这种情况</ p>

谢谢!</ p>
</ div>

展开原文

原文

we want to modify an Awesome Font icon in our WordPress theme for the whole web. The theme is built with a framework (bebel) and we do not know how to modify the HTML to change the class in the code, because in addition it uses VisualComposer for custom boxes.

Then we want to change the icon by css, I'm going to an option to add extra css of my theme and I put the following rule:

CSS input:

.fa-location-arrow::before {
    font-family: FontAwesome;
    content: "\f041" !important;
}

The changes do not apply, pulse F12 in chrome and inspect the icon. The CSS rule looks like this.

CSS Output:

.fa-location-arrow::before {
     Font-family: FontAwesome;
     Content: \"\\f041\" !important;
 }

CSS Output image:

F12 Chrome CSS error syntax Image

Is it possible that when saving the css, the topic is processed in php in some special way? Who knows why this happens

Thank you!

dreamy1992
dreamy1992 这很奇怪,它似乎在JSFiddle-jsfiddle.net/qnsvusdk中运行良好
3 年多之前 回复
dongnachuang6635
dongnachuang6635 您是否尝试过重新安排样式表的顺序?您可能希望DOM最后加载自己的样式表。
3 年多之前 回复
doufei7464
doufei7464 你能否展示一下你输出修改的代码?
3 年多之前 回复

2个回答



我刚刚解决了它。 我已从包含主题的“全局CSS”选项中删除了css,并将相同的代码粘贴到WordPress子主题的“style.css”文件中。 现在它完美地工作,虽然我仍然不明白为什么它以前不起作用。 我怀疑它会通过php写入css的某种方式。</ p>

谢谢大家!</ p>
</ div>

展开原文

原文

I just solved it. I have removed the css from the "Global CSS" option that includes the theme and I pasted the same code into the "style.css" file of the WordPress child theme. Now it works perfectly although I still do not understand why it did not work before. I suspect it will be some way to write to the css through php.

Thank you all!



似乎缺少fontawesome,所以请将其下载并放入主题css文件夹并将其链接到您的functions.php中</ p>

  function enqueue_fontawesome(){
wp_enqueue_style('font-awesome',$ template_dir。'/ css / font-awesome.min.css',array());
}
add_action('wp_enqueue_scripts','enqueue_fontawesome');
</ code> </ pre>

根据您的主题文件夹结构更改css文件路径。 希望这对你有用。</ p>
</ div>

展开原文

原文

Seems that the fontawesome is missing, so download it and place it in your theme css folder and linked it in your functions.php

 function enqueue_fontawesome(){
    wp_enqueue_style( 'font-awesome', $template_dir . '/css/font-awesome.min.css', array() );
}
add_action('wp_enqueue_scripts','enqueue_fontawesome');

change the css file path according to your theme folder structure. Hope this will work for you.

duanbi8089
duanbi8089 嗨,迈克很棒,它解决了......
3 年多之前 回复
duanmu2013
duanmu2013 错误是另一个,但对另一个人来说可能是一个有用的答案,谢谢。
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐