Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Save button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Samriddhi15
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 Save button
Save button is an animated CSS button by @Samriddhi15. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Loading, Icon, Animated
- 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">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Save button</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button>
<i class='fa fa-check '></i>
<!-- <i class='fa fa-circle-o-notch fa-spin fa-1x'></i> -->
<span class="btn-text">Save</span>
</button>
<script src="app.js"></script>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
border: 0;
font-family: "Futura md bt";
outline: none;
}
body{
display: grid;
place-content: center;
height: 100vh;
background: #183153;
}
button{
width: 140px;
height: 50px;
color: #183153;
background: #63e6be;
border-radius: 5px;
font-size: 22px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
}
button i{
font-size: 25px;
}
.fa-check{
border: 1px solid #183153;
width: 17px;
height: 17px;
border-radius: 50%;
font-size: 12px;
line-height: 17px;
}
.fa-check.checked{
color: #63e6be;
background: #183153;
}
button .btn-txt{
margin-left: 7px;
}
.fa-circle-notch{
animation: animate 1s ease infinite;
}
@keyframes animate {
0% {
transition: rotate(0turn);
}
100% {
transform: rotate(1turn);
}
}JavaScript
btn = document.querySelector("button"),
spinner = document.querySelector(".fa-circle-o-notch.fa-spin"),
icon = document.querySelector("i"),
btnText = document.querySelector(".btn-text");
btn.onclick = function() {
btn.style.cursor = "wait";
btnText.textContent = "";
btnText.style.margin = 0;
icon.classList.remove("fa-check");
icon.classList.add("fa-circle-o-notch", "fa-spin");
setTimeout(() => {
btn.style.pointerEvents = "none";
btnText.textContent = "done";
icon.classList.remove("fa-circle-o-notch", "fa-spin");
icon.classList.add("fa-check", "checked");
}, 4000);
}