如何对字体超赞的图标进行四舍五入? [英] How to round font-awesome icons?

查看:53
本文介绍了如何对字体超赞的图标进行四舍五入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对超赞字体的图标进行四舍五入.请参考- http://jsfiddle.net/JfGVE/1704/

I am trying to round font-awesome icon. Please refer - http://jsfiddle.net/JfGVE/1704/

问题是,无论如何,圆形图标都更椭圆.无法使其完美地四舍五入.以下是我拥有的CSS代码-

The problem is, not matter what, the rounded icon is more oval. Not able to make it a perfectly rounded. Below is the css code i have -

i {
display: inline-block;
background: gray;
color: white;
border-radius: 50%;
padding: 5px;
}

推荐答案

尝试调整高度/宽度并重置行高:

Try to adjust height/width and reset line-height:

i {
  display: inline-block;
  background: gray;
  color: white;
  border-radius: 50%;
  padding: 0.3em; /* adjust padding */
  line-height: initial !important; /* reset line-height */
  height: 1em;
  width: 1em;
  text-align:center;
}

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
<i class="fa fa-close"></i>
<br>
<i class="fa fa-camera-retro fa-lg"></i> fa-lg
<i class="fa fa-camera-retro fa-2x"></i> fa-2x
<i class="fa fa-close fa-3x"></i> fa-3x
<i class="fa fa-info fa-4x"></i> fa-4x
<i class="fa fa-camera-retro fa-5x"></i> fa-5x

图标大小不等于高度/宽度.因此,我更改了答案并添加了 height:1em;宽度:1em;文本对齐:居中;

the icon size is not equal height/width. So I changed the answer and added height: 1em; width: 1em; text-align: center;

这篇关于如何对字体超赞的图标进行四舍五入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆