Can font-awesome icon background be transparent?

只谈情不闲聊 提交于 2019-12-23 09:24:49

问题


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?

Current Code is:

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

回答1:


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

Demo Fiddle

i::before{
    background:transparent;
}

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

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


来源:https://stackoverflow.com/questions/23778391/can-font-awesome-icon-background-be-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!