HTML code for social media buttons to website

Learn how to style social media buttons with CSS.

Step 1) Add HTML:
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- Add font awesome icons -->
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
...

Step 2) Add CSS:
/* Style all font awesome icons */
.fa {
  padding: 20px;
  font-size: 30px;
  width: 50px;
  text-align: center;
  text-decoration: none;
}

/* Add a hover effect if you want */
.fa:hover {
  opacity: 0.7;
}

/* Set a specific color for each brand */

/* Facebook */
.fa-facebook {
  background: #3B5998;
  color: white;
}

/* Twitter */
.fa-twitter {
  background: #55ACEE;
  color: white;
}

Round Buttons

Tip: Add border-radius:50% to create round buttons, and reduce the width:

.fa {
  padding: 20px;
  font-size: 30px;
  width: 30px;
  text-align: center;
  text-decoration: none;
  border-radius: 50%;
}


code source example :


<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.fa {
  padding: 20px;
  font-size: 30px;
  width: 50px;
  text-align: center;
  text-decoration: none;
  margin: 5px 2px;
}

.fa:hover {
    opacity: 0.7;
}

.fa-facebook {
  background: #3B5998;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-twitter {
  background: #55ACEE;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-google {
  background: #dd4b39;
   color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-linkedin {
  background: #007bb5;
   color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-youtube {
  background: #bb0000;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-instagram {
  background: #125688;
  color: white;
   border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-pinterest {
  background: #cb2027;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-snapchat-ghost {
  background: #fffc00;
  color: white;
  text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}
.fa-anyycanal {
background: rgb(102,50,114);
background-image: url(https://anycanal.com/lib/pb.png);
background-size: 30px;
border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
background-repeat: no-repeat;
background-position: 13px;
margin: 0px 0px -18px 0;
}

.fa-skype {
  background: #00aff0;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-android {
  background: #a4c639;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-dribbble {
  background: #ea4c89;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-vimeo {
  background: #45bbff;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-tumblr {
  background: #2c4762;
  color: white;
   border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-vine {
  background: #00b489;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-foursquare {
  background: #45bbff;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-stumbleupon {
  background: #eb4924;
  color: white;
   border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-flickr {
  background: #f40083;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-yahoo {
  background: #430297;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-soundcloud {
  background: #ff5500;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-reddit {
  background: #ff5700;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}

.fa-rss {
  background: #ff6600;
  color: white;
  border-radius: 50%;
width: 25px;
height: 25px;
padding: 15px;
}
</style>
</head>
<body>

<h2>Style Social Media Buttons</h2>

<!-- Add font awesome icons -->
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-google"></a>
<a href="#" class="fa fa-linkedin"></a>
<a href="#" class="fa fa-youtube"></a>
<a href="#" class="fa fa-instagram"></a>
<a href="#" class="fa fa-pinterest"></a>
<a href="#" class="fa fa-snapchat-ghost"></a>
<a href="#" class="fa fa-anyycanal"></a>
<a href="#" class="fa fa-skype"></a>
<a href="#" class="fa fa-android"></a>
<a href="#" class="fa fa-dribbble"></a>
<a href="#" class="fa fa-vimeo"></a>
<a href="#" class="fa fa-tumblr"></a>
<a href="#" class="fa fa-vine"></a>
<a href="#" class="fa fa-foursquare"></a>
<a href="#" class="fa fa-stumbleupon"></a>
<a href="#" class="fa fa-flickr"></a>
<a href="#" class="fa fa-yahoo"></a>
<a href="#" class="fa fa-reddit"></a>
<a href="#" class="fa fa-rss"></a>
     
</body>
</html>







Sign In or Register to comment.