Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Siddharth961's button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
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 Siddharth961's button
Siddharth961's button is an animated CSS button by @Siddharth961. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- 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>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="left bar"></div>
<button class="initial">Text</button>
<div class="right bar"></div>
</div>
<script src="app.js"></script>
</body>
</html>
CSS
body{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container{
border-width: 2px 0px ;
border-style: solid ;
border-color: black;
width: 10vw;
height: 5vh;
text-align: center;
display: flex;
justify-content: space-between ;
overflow: hidden;
}
button{
z-index: 1;
position: relative;
height: 100%;
width: 90%;
background-color: white;
color: green;
font-size: 14px;
border: 0px;
cursor: pointer;
text-transform: uppercase;
}
.active{
animation-name: animation-button;
animation-duration: 2s;
}
.bar{
z-index: 2;
position: relative;
height: 100%;
border-width: 0px 1px ;
border-style: solid ;
border-color: black;
}
.left.active{
animation-name: animation-left;
animation-duration: 2s;
}
.right.active{
animation-name: animation-right;
animation-duration: 2s;
}
@keyframes animation-left {
0%{
width: 0px;
left: 0%;
border-color: transparent;
box-shadow: 2px 2px 25px green;
border-radius: 4px;
}
20%{
width: 2px;
left: 0%;
background-color: green;
box-shadow: 4px 4px 18px green;
}
80%{
width: 2px;
background-color: green;
left: 100%;
box-shadow: 4px 4px 18px green;
}
100%{
width: 0px;
left: 100%;
border-color: green;
box-shadow: 2px 2px 25px green;
border-radius: 4px;
}
}
@keyframes animation-right {
0%{
width: 0px;
right: 0%;
border-color: transparent;
box-shadow: 2px 2px 25px green;
border-radius: 4px;
}
20%{
width: 2px;
right: 0%;
background-color: green;
box-shadow: 4px 4px 18px green;
}
80%{
width: 2px;
background-color: green;
right: 100%;
box-shadow: 4px 4px 18px green;
}
100%{
width: 0px;
right: 100%;
border-color: green;
box-shadow: 2px 2px 25px green;
border-radius: 4px;
}
}
@keyframes animation-button {
20%{
text-shadow: 2px 2px 10px white;
}
40%{
text-shadow: 0px 2px 30px green;
}
60%{
text-shadow: 0px 2px 30px green;
}
80%{
text-shadow: 2px 2px 10px white;
}
}
JavaScript
const btnel = document.querySelector('button')
const container = document.querySelector('.container')
const left = document.querySelector('.left')
const right = document.querySelector('.right')
console.log(btnel)
btnel.addEventListener('click',()=>{
left.classList.add('active')
right.classList.add('active')
btnel.classList.add('active')
setTimeout(()=>{
btnel.innerText = 'Change'
},750)
})