问题
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