isrk dakota isrk dakota - 9 days ago 5
CSS Question

How to round font-awesome icons?

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

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;
}

Answer

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 */
  heigth: 1em;
  width: 1em;
  text-align:center;
}
<link rel="stylesheet" href="http://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

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