字体超赞图标背景可以透明吗? [英] Can font-awesome icon background be transparent?

查看:121
本文介绍了字体超赞图标背景可以透明吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用字体超棒的"x"图标-但它具有白色背景-字体超棒的背景可以透明吗?

I am using a font awesome "x" icon - but it has a white background - can font-awesome backgrounds be transparent?

原因是,我想在图像上显示它.我需要什么选项?

The reason is, I want to display it over an image. What option do I need to do this?

当前代码为:

 <i class="fa fa-times fa- m-n"></i>

推荐答案

是的,字体超赞的图标使用::before伪字体,因此只需这样做,例如:

Yes, font awesome uses the ::before psuedo for its icons, so simply do, e.g.:

i::before{
    background:transparent;
}

也就是说,您可能会希望使用比i更为简单的特异性,例如:

That said, you will likely want to use more specificity than simply i, e.g.:

i[class*=fa-times]::before{
   background:transparent;
}

这篇关于字体超赞图标背景可以透明吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆