I have a little problem with Font Awesome icon.
I have 2 same versions of website (for development and tests) and the icon displays differently while having same CSS styles.
I described this problem with this icon:

.btnFilter {
color: #666666;
padding-top: 4px;
font-size: 18px;
text-align: center;
}
.circle {
border: solid #999 1px;
border-radius: 13px;
box-sizing: border-box;
width: 26px;
height: 26px;
text-align: center;
font-size: 18px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<i class="fa fa-times circle btnFilter"></i>
This CSS and HTML markup is placed on both dev and test versions, chrome dev tools displays same styles, and hovering font-awesome icon :before pseudoelement's size gives result as on the image above.
I think you would be better served by using em rather than px values here...then everything adjusts to the font size.
As to your specific issue, there is a clash between line-height/font-size in font-awesome and your specific styles.
The top padding is also probably not required.
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
.btnFilter {
color: #666666;
font-size: 160px !important;
/* for demo only */
line-height: 1em;
text-align: center;
}
.fa::before {
line-height: inherit;
}
.circle {
border: solid #999 1px;
border-radius: 50%;
width: 1.1em;
height: 1.1em;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" />
<i class="fa fa-times circle btnFilter"></i>
Codepen Demo
I believe it has to do with the font-size. I think its because font-awesome has a declaration of
font: normal normal normal 14px/1 FontAwesome;
So remove the font-size or adjust your font-size using em and it should work as expected
if you add !important to your font-size you will see the weird result that you see on one of your sites.
.btnFilter {
color: #666666;
padding-top: 4px;
font-size: 18px !important;
text-align: center;
}
.circle {
border: solid #999 1px;
border-radius: 13px;
box-sizing: border-box;
width: 26px;
height: 26px;
text-align: center;
font-size: 18px !important;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<i class="fa fa-times circle btnFilter"></i>
Or you could do this
.circle{
width:18px;
height:18px;
padding: 3px;
background-color:white;
border-radius:100%;
line-height:18px;
text-align:center;
vertical-align:middle;
display:inline-block;
border: solid #999 1px;
}
.btnFilter {
line-height: inherit;
font-size: 18px;
color: #666666;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="circle">
<i class="fa fa-times btnFilter"></i>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With