Bootstrap 3: Can the Glyphicons be stacked like Font Awesome's icons?

孤街醉人 提交于 2019-11-29 01:52:09

Bootstrap's CSS for Glyphicons don't have classes to stack. You could apply the classes from your example code: http://bootply.com/88775

css

.icon-stack {
    display: inline-block;
    height: 2em;
    line-height: 2em;
    position: relative;
    vertical-align: -35%;
    width: 2em;
}
.icon-stack .icon-stack-base {
    font-size: 2em;
}
.icon-stack [class^="icon-"], .icon-stack [class*=" icon-"] {
    display: block;
    font-size: 1em;
    height: 100%;
    line-height: inherit;
    position: absolute;
    text-align: center;
    width: 100%;
}
.icon-stack .glyphicon{
    font-size: 2em;
}
.glyphicon-ban-circle
{
    color:red;
}

html

<span class="icon-stack">
<i class="glyphicon glyphicon-phone icon-stack-base"></i>
<i class="glyphicon glyphicon-ban-circle"></i>
</span>

Here is a shorter, cleaner version (of Bass Jobsen' solution)

css

.icon-stack {
    position: relative;
}
.icon-stack .glyphicon {
    position: absolute; 
}

html

<span class="icon-stack">
   <i class="glyphicon glyphicon-unchecked"></i>
   <i class="glyphicon glyphicon-ok"></i>
</span>

example

http://jsfiddle.net/58aED/2/

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