Font Awesome 5 whatsapp icon CSS style

ace picture ace · Apr 18, 2018 · Viewed 13.6k times · Source

I tried the below code to render whatsapp icon using font awesome 5:

<i style="background-color: #25d366; color: white;" class="fab fa-whatsapp "></i>

But it looks like this:

enter image description here

What I want is to make it look like whatsapp icon that appears in Android phones i.e without the square green background. How to achieve this?

Answer

Temani Afif picture Temani Afif · Apr 18, 2018

You can try to color the background with gradient:

.fa-whatsapp  {
  color:#fff;
  background:
   linear-gradient(#25d366,#25d366) 14% 84%/16% 16% no-repeat,
   radial-gradient(#25d366 60%,transparent 0);
}
<script defer src="https://use.fontawesome.com/releases/v5.2.0/js/all.js"></script>
<i class="fab fa-whatsapp fa-7x"></i> 
<i class="fab fa-whatsapp fa-5x"></i>
<i class="fab fa-whatsapp fa-2x"></i>

With the CSS version:

.fa-whatsapp  {
  color:#fff;
  background:
   linear-gradient(#25d366,#25d366) 14% 84%/16% 16% no-repeat,
   radial-gradient(#25d366 58%,transparent 0);
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" >
<i class="fab fa-whatsapp fa-7x"></i>
<i class="fab fa-whatsapp fa-5x"></i>
<i class="fab fa-whatsapp fa-2x"></i>