【问题标题】:fontawesome icon not rendering the same in Chrome and Firefoxfontawesome 图标在 Chrome 和 Firefox 中呈现不一样
【发布时间】:2015-03-06 00:49:37
【问题描述】:

在 Chrome/Safari 中,我的引导按钮内的图标看起来不错:

但在 Firefox 中,图标会下降一行:

我在<button> 内浮动了一个很棒的图标。

<!--html-->
<div class="btn-group btn-group-justified" role="group" aria-label="...">
  <div class="btn-group" role="group">
     <button type="button" class="btn btn-default btn-small">Cached logs<i class="fa fa-money"></i></button>
  </div>

  <div class="btn-group" role="group">
   <button type="button" class="btn btn-default btn-small">Logs on mount<i class="fa fa-database"></i></button>
  </div>
</div>

<!--style-->
i.fa {
float: right;
top: 2px;
position: relative;
font-size: 12pt;
}
.glyphicon, i.fa {
color: rgb(90, 90, 90);
top: 1px;
}

如何让 Firefox 版本像 Chrome 一样单行?

JSBIN

【问题讨论】:

    标签: css twitter-bootstrap cross-browser compatibility font-awesome


    【解决方案1】:

    将图标移动到文本的左侧。我不确定导致它与您的获取方式不一致的根本原因 - 但这确实使两个浏览器都能一致地呈现它。

    <button type="button" class="btn btn-default btn-small"><i class="fa fa-database"></i>Logs on mount</button>
    

    代替

    <button type="button" class="btn btn-default btn-small">Logs on mount<i class="fa fa-database"></i></button>
    

    【讨论】:

    • 我真的很想知道它是如何工作的。我从没想过要试试!非常感谢。
    • 不客气。猜测一下,我会说Firefox出于某种奇怪的原因将文本呈现为按钮内的块级元素。当我尝试调试时不明白为什么。由于浮动元素不流畅,因此将其放在文本之前是有意义的 - 所以我对其进行了测试并且它有效:) 如果有人可以解释,我很乐意听到这个消息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-02
    • 2021-10-27
    • 1970-01-01
    • 2020-08-04
    • 2021-09-07
    • 2018-05-21
    相关资源
    最近更新 更多