Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Social share button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Nishusk
Button submission checks
Checks will appear after the preview updates.
Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.
Accessibility quick check
Waiting for the rendered preview…
Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.
Explore freely here. Remix to publish your version with credit to the creator.
About Social share button
Social share button is an animated CSS button by @Nishusk. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, Icon, Social
- Using this example
- Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.
Usage, Tailwind and licensing questions
Read the source files
HTML
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Social share button</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:700'><link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div class="share">
<span>Share</span>
<nav>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-google"></i></a>
<a href="#"><i class="fa fa-github"></i></a>
</nav>
</div>
<!-- partial -->
<script src="./script.js"></script>
</body>
</html>
CSS
body {
font-family: "Roboto";
background-color: #e5eef3;
text-align: center;
color: #f1ce64;
font-size: 28px;
}
a {
color: #f1ce64;
}
.share {
position: absolute;
width: 400px;
left: 50%;
margin-left: -200px;
top: 50%;
margin-top: -40px;
border-radius: 80px;
}
.share span {
width: 200px;
line-height: 80px;
display: inline-block;
font-weight: 700;
text-transform: uppercase;
position: absolute;
left: 50%;
margin-left: -100px;
opacity: 1;
transition: opacity 0.3s ease-in-out;
pointer-events: none;
}
.share nav {
font-size: 0;
}
.share a {
line-height: 80px;
width: 80px;
text-align: center;
display: inline-block;
background-color: #ffffff;
color: #ffffff;
overflow: hidden;
opacity: 1;
transition: all 0.3s ease-in-out;
margin: 0 -20px;
box-shadow: 3px 1px 3px rgba(0, 0, 0, 0.1);
}
.share a:nth-child(1) {
border-top-left-radius: 40px;
border-bottom-left-radius: 40px;
margin-left: 0;
}
.share a:nth-child(1):hover {
background-color: #61c5ec;
}
.share a:nth-child(2):hover {
background-color: #3B5998;
}
.share a:nth-child(3):hover {
background-color: #ea4335;
}
.share a:nth-child(4) {
border-top-right-radius: 40px;
border-bottom-right-radius: 40px;
margin-right: 0;
}
.share a:nth-child(4):hover {
background-color: #000000;
}
.share:hover span, .share.hover span {
opacity: 0;
}
.share:hover a, .share.hover a {
border-radius: 50%;
margin: 0 10px;
color: #f1ce64;
font-size: 28px;
}
.share:hover a:hover, .share.hover a:hover {
color: #fff;
}JavaScript
// Force a hover to see the effect
const share = document.querySelector('.share');
setTimeout(() => {
share.classList.add("hover");
}, 1000);
setTimeout(() => {
share.classList.remove("hover");
}, 3000);