How do I give a font awesome icon a background color?
I'm surprised no one has mentioned this approach yet:
html
<div class="social-media text-right">
<a href="" class="facebook">
<span class="fa fa-facebook"></span>
</a>
</div>
css
.social-media a
{
display: inline-block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
margin-right: 10px;
border-radius: 34px;
}
.social-media a.facebook
{
background: #3b5998;
}
Use stacked icons instead . Here is a fiddle, you can play with it to make it far more better. Below is full code :
HTML
<ul class="list-inline">
<li><a href="#">
<span class="fa-stack fa-lg icon-facebook">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x"></i>
</span>
</a></li>
<li><a href="#">
<span class="fa-stack fa-lg icon-twitter">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x"></i>
</span>
</a></li>
<li><a href="#">
<span class="fa-stack fa-lg icon-gplus">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-plus fa-stack-1x"></i>
</span>
</a></li>
</ul>
CSS
.fa-stack-1x {
color:white;
}
.icon-facebook {
color:#3b5998;
}
.icon-twitter {
color:#00aced;
}
.icon-gplus{
color:#dd4b39;
}
body {
background-color: black;
}