我正在使用我在 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/