首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多种图标字体

多种图标字体
EN

Stack Overflow用户
提问于 2015-06-10 15:21:06
回答 1查看 364关注 0票数 0

我们使用的是字形图标、FontAwesome和自定义的图标字体。

现在我要解决的问题是这些图标不在同一行上:

我们有一个CSS类,它使图标变大,并且图标在同一行上:

代码语言:javascript
复制
.icon-5x {
    font-size: 5em !important;
    vertical-align: text-bottom;
}

之后,我尝试将vertical-align:text-bottom;添加到图标字体的基类中:

代码语言:javascript
复制
.fa {
    display: inline-block;
    font: normal normal normal 14px/1 FontAwesome;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translate(0, 0);
    vertical-align: text-bottom;
}
[class^="icon-custom-"], [class*=" icon-custom-"] {
    display: inline-block;
    font: normal normal normal 14px/1 custom-icons;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translate(0, 0);
    vertical-align: text-bottom;
}
.glyphicon {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
    font: normal normal normal 14px/1 'Glyphicons Halflings';
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translate(0, 0);
    vertical-align: text-bottom;
}

但现在图标仍然不在同一行上:(

我想我可以解决这个问题,如果我只做一个自定义字体,其中包含所有3个图标字体,但我希望能够轻松地更新fontAwesome或Glyhpicons…

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2015-06-10 16:05:13

以下是我的解决方案:

代码语言:javascript
复制
[class^="icon-custom-"], [class*=" icon-custom-"] {
    display: inline-block;
    font: normal normal normal 14px/1 custom-icons;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translate(0, 0);
    vertical-align: text-bottom;
    line-height: 1;
}
.glyphicon {
    top: 0px!important;
    vertical-align: text-bottom!important;
}
.fa {
    line-height: 1!important;
    vertical-align: text-bottom!important;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30749669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档