我正在从 Twitter Bootstrap v2 迁移到 v3。在 v2 中,我有十几个在 css 中定义的自定义图标:
.icon-pc {
background-image: url("pc.png");
background-position: center center;
}
我知道在 Twitter Bootstrap v3 中他们现在使用 Glyphicons,但这对我来说不是一个现实的方法,因为我的图标是多色 PNG 文件并且不能很好地用作字体...
有没有一种简单的方法可以像旧的 v2 图标那样在 v3 中完成这些工作?
最佳答案
从 sprites.less 生成的 css 中复制了这个 block ,效果非常好:
[class^="icon-"],
[class*=" icon-"] {
display: inline-block;
width: 14px;
height: 14px;
*margin-right: .3em;
line-height: 14px;
vertical-align: text-top;
background-position: 14px 14px;
background-repeat: no-repeat;
margin-top: 1px;
}
现在我的好老<i class="icon-custom"></i>
工作正常。
关于css - 在 Twitter Bootstrap 3 中使用图像图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19435997/