简体   繁体   English

CSS内容中的FontAwesome图标

[英]FontAwesome Icons in css content

So I just asked this question , and it works fine. 所以我只是问了这个问题 ,效果很好。 But when I thought; 但是当我想到 what if I try to put font-icons or glyphs into css' content property? 如果我尝试将字体图标或字形放入CSS的content属性中怎么办?

Here's the fiddle . 这是小提琴 So is this even possible, how do I get a fontawesome icons to render in css' content property? 所以这甚至有可能,我如何获得一个字体丰富的图标来呈现在CSS的content属性中?

.item a p.new-label span{
  position: relative;
  content: 'NEW'
}
.item:hover a p.new-label span{
  display: none;
}
.item:hover a p.new-label:after{
  content: '\f014';
}

Thank you for your help in advance. 提前谢谢你的帮助。

You just need to set the font-family in your .item:hover and you'll be good to go. 您只需要在.item:hover中设置字体系列,就可以了。

http://jsfiddle.net/bhlaird/JfGVE/13/ http://jsfiddle.net/bhlaird/JfGVE/13/

.item:hover a p.new-label:after {
    font-family:FontAwesome;
    content:'\f014';
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM