I'm having this weird problem with my font awesome icons. I wanted my icons to have a round border. I don't want to use border: 1px solid
because icon border will look blurry. I have achieved this smooth border by the "stacking method
" of font-awesome as described here
Since my font is 64px large, this fa-circle-thin
icons border is too thick. To avoid that I used box-shadow
.
My problem is that my icon border is not uniform.
In chrome, border is a little thick at left side.(Somehow I can't replicate this issue in fiddle/snippet so which can be neglected.)
but in safari, border is thick at right side.
How to get rid of this issue ? I don't want to use -webkit-text-stroke
as it has limited browser support. Any help is much appreciated :)
FIDDLE
Here is my code.
a{
text-decoration: none;
}
.social-block .fa {
font-size: 64px;
}
span.fa-stack {
width: 64px;
height: 64px;
}
.social-block .fa-stack-1x:before {
font-size: 24px;
vertical-align: top;
line-height: 64px;
}
.social-block .fa-stack-1x{
box-shadow: inset 0 0 0px 7px #fff;
position: absolute;
top: -1px;
}
.social-block a:hover .fa-stack-1x{
box-shadow: none;
}
.social-block a:hover .fa-stack-1x:before {
width: 50px;
height: 50px;
line-height: 50px;
left: 7px;
top: 7px;
position: absolute;
}
.social-block .fa {
color: #CC1E4A;
border-radius: 50%;
-webkit-transition: all ease .25s;
-moz-transition: all ease .25s;
-o-transition: all ease .25s;
transition: all ease .25s;
font-size: 64px;
}
.social-block a:hover .fa-circle-thin {
background: none;
}
.social-block a:hover .fa-stack-1x:before {
background: #CC1E4A;
display: block;
border-radius: 50%;
}
.social-block a:hover .fa-stack-1x {
color: #fff;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="social-block">
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle-thin fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x"></i>
</span>
</a>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle-thin fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x"></i>
</span>
</a>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle-thin fa-stack-2x"></i>
<i class="fa fa-linkedin fa-stack-1x"></i>
</span>
</a>
</div>
You can't change the weight of the current Font Awesome icons, however the designer also created a commercial set of multi-weight icon fonts called Black Tie, which includes light font.
As a workaround, instead of stacked icons, I would suggest to just use the normal icons and draw the circles with border-radius
. Keep it simple, and easy to update.
Jsfiddle Example
.social-block a {
position: relative;
text-decoration: none;
display: inline-block;
margin: 10px;
color: #cc1e4a;
background-color: #fff;
border: 1px solid #cc1e4a;
border-radius: 50%;
box-sizing: border-box;
width: 50px;
height: 50px;
text-align: center;
transition: all .25s ease;
transition-property: color, box-shadow;
}
.social-block a:hover {
box-shadow: 0 0 0 3px #cc1e4a;
background-color: #cc1e4a;
color: #fff;
}
.social-block .fa {
font-size: 24px;
height: 100%;
}
/* center icon vertically */
.social-block .fa:after {
content: "";
height: 100%;
display: inline-block;
vertical-align: middle;
}
/* box-shadow white line fixes */
.social-block a:hover:after {
content: "";
position: absolute;
left: -3px; right: -3px;
top: -3px; bottom: -3px;
border-radius: 50%;
border: 6px solid #cc1e4a;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="social-block">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-linkedin"></i></a>
</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