To be different, you can put the social buttons in a circular order. Isn’t it better than sorting them one after another? The following code is a share button. When you click on it the sharing buttons appear in a circle surrounding the main button. It helps you save the space, too.
HTML
<!-- This script got from www.devanswer.com -->
<nav class="circular-menu">
<div class="circle">
<a class="fa fa-thumbs-o-up fa-2x" title="Like On Facebook" href="https://www.facebook.com/plugins/like.php?href=http://devanswer.com"></a>
<a class="fa fa-facebook fa-2x" title="On Facebook" href="https://www.facebook.com/sharer.php?u=http://devanswer.com"></a>
<a class="fa fa-twitter fa-2x" title="On Twitter" href="https://twitter.com/intent/tweet?text=DevAnswer&url=http://devanswer.com"></a>
<a class="fa fa-linkedin fa-2x" title="On LinkedIn" href="https://www.linkedin.com/shareArticle?mini=true&url=http://devanswer.com"></a>
<a class="fa fa-tumblr fa-2x" title="On Tumblr" href="http://www.tumblr.com/share/link?url=http://devanswer.com"></a>
<a class="fa fa-reddit-alien fa-2x" title="On Reddit" href="http://reddit.com/submit?url=http://devanswer.com&title=DevAnswer"></a>
<a class="fa fa-pinterest fa-2x" title="Pin It" href="https://www.pinterest.com/pin/create/button/?url=http://devanswer.com"></a>
<a class="fa fa-vk fa-2x" title="On VK.com" href="https://vk.com/share.php?url=http://devanswer.com"></a>
</div>
<a href="" class="menu-button fa fa-share-alt fa-2x"></a>
</nav>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Developers Answer</a></div>
CSS
@import "https://netdna.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.css";
body {
background: #39D;
}
.circular-menu {
width: 250px;
height: 250px;
margin: 0 auto;
position: relative;
}
.circle {
width: 250px;
height: 250px;
opacity: 0;
-webkit-transform: scale(0);
-moz-transform: scale(0);
transform: scale(0);
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
}
.open.circle {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1);
}
.circle a {
text-decoration: none;
color: white;
display: block;
height: 40px;
width: 40px;
line-height: 40px;
margin-left: -20px;
margin-top: -20px;
position: absolute;
text-align: center;
}
.circle a:hover {
color: #eef;
}
.menu-button {
position: absolute;
top: calc(50% - 30px);
left: calc(50% - 30px);
text-decoration: none;
text-align: center;
color: #444;
border-radius: 50%;
display: block;
height: 40px;
width: 40px;
line-height: 40px;
padding: 10px;
background: #dde;
}
.menu-button:hover {
background-color: #eef;
}
/* Author stuff */
h1.author {
text-align:center;
color: white;
font-family: Helvetica, Arial, sans-serif;
font-weight: 300;
}
h1.author a {
color: #348;
text-decoration:none;
}
h1.author a:hover {
color: #ddd;
}
Javascript
var items = document.querySelectorAll('.circle a');
for (var i = 0, l = items.length; i < l; i++) {
items[i].style.left = (50 - 35 * Math.cos(-0.5 * Math.PI - 2 * (1 / l) * i * Math.PI)).toFixed(4) + "%";
items[i].style.top = (50 + 35 * Math.sin(-0.5 * Math.PI - 2 * (1 / l) * i * Math.PI)).toFixed(4) + "%";
}
document.querySelector('.menu-button').onclick = function (e) {
e.preventDefault();document.querySelector('.circle').classList.toggle('open');
};