【问题标题】:Can font-awesome icon background be transparent?字体真棒图标背景可以透明吗?
【发布时间】:2014-07-09 19:30:02
【问题描述】:

我正在使用字体很棒的“x”图标 - 但它有一个白色背景 - 字体很棒的背景可以是透明的吗?

原因是,我想在图像上显示它。我需要什么选项来执行此操作?

当前代码是:

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

【问题讨论】:

    标签: css twitter-bootstrap fonts font-awesome


    【解决方案1】:

    是的,font awesome 使用::before psuedo 作为其图标,所以只需这样做,例如:

    Demo Fiddle

    i::before{
        background:transparent;
    }
    

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

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

    【讨论】:

    • 感谢您的回答!
    • 我是否像上面那样把它放在我的css中?我从未使用过 ::before 属性
    猜你喜欢
    • 2019-01-01
    • 1970-01-01
    • 2014-12-18
    • 1970-01-01
    • 2020-07-07
    • 2019-02-12
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    相关资源
    最近更新 更多