css - 增加字体大小时图标字体类不对齐

标签 css font-size glyphicons icon-fonts foundation-icon-fonts

我正在使用我在 http://iconvau.lt/ 中创建的图标字体,但是当我放置文本对齐居中时,图标不会居中。它留在左边。

html

<ul>
  <li class="col-md-2">
   <div class="icon-2"></div>
  </li>
</ul>

css:
       ul{ width: 200px; text-align: center; height: 200px;}
       li {background: #fff;}
      .icon-2:before {
           content: "\f104"; text-align: center; font-family: "iconvault";
           font-style: normal;
           font-weight: normal;
           font-variant: normal;
           text-transform: none;
           line-height: 1;
           -webkit-font-smoothing: antialiased;
           display: inline-block;
           text-decoration: inherit;
           color: #1b93b6;}

最佳答案

尝试将图标的边距设置为自动:

.icon-2 {
    margin: auto;
}

关于css - 增加字体大小时图标字体类不对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28154983/

相关文章:

css - "font-size: 100%"的问题

javascript - 将 Glyphicon 动态添加到表格行

fonts - Twitter bootstrap 3 - 创建自定义字形并添加到字形 "font"

html - 将文本添加到图像横幅

HTML DIV 内联 block

html - Bootstrap - 图像被拉伸(stretch)到 div 的宽度

objective-c - UILabel字体大小?

css - 字体大小可以是 css/css3 中容器大小的百分比吗?

html - 我如何将图标添加到 Bootstrap 下拉列表

html - quora 如何将该图像放在他们的主页上?