重写Font Awesome的glyphicon代码

时间:2016-02-16 01:21:35

标签: twitter-bootstrap fontawesome-4.4.0

我目前正在使用以下代码与我的标题显示几个字形(glyphicon-chevron-down和glyphicon-remove-sign):

<h2 class="h2Article collapsed" id="a4" data-toggle="collapse" data-target="#b4" aria-expanded="false"><span class="Article"><span class="label label-primary"><small><span class="only-collapsed glyphicon glyphicon-chevron-down"></span><span class="only-expanded glyphicon glyphicon-remove-sign"></span></small> Acquired LifeTags</span></span></h2>

我刚刚发现了Font Awesome的最新图书馆并希望尝试一下。我应该如何修改上面的代码来替换glyphicon-chevron-down?

<i class="fa fa-chevron-down fa-2x"></i>

P.S。我应该补充一点,如果可能的话,我想简化我的代码。四个单独的跨度太多了。 ;)

1 个答案:

答案 0 :(得分:1)

替换

<span class="only-collapsed glyphicon glyphicon-chevron-down"></span>

通过

<i class="only-collapsed fa fa-chevron-down fa-2x"></i>

不再:P

你应该得到这样的东西:

<h2 class="h2Article collapsed Article label label-primary" id="a4"
     data-toggle="collapse" data-target="#b4" aria-expanded="false">
    <small>
        <i class="only-collapsed fa fa-chevron-down fa-2x"></i>
        <i class="only-expanded glyphicon glyphicon-remove-sign"></i>
    </small>
    &nbsp;Acquired LifeTags
</h2>