Back to buttons

Live preview

Preview settings

Changes appear as you type. Use Tab to test keyboard focus.

⌘ / Ctrl + S saves locally

Sagnik3788's button

HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.

By @Sagnik3788

Remix button

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 Sagnik3788's button

Sagnik3788's button is an animated CSS button by @Sagnik3788. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.

Effects and categories
Hover effects, 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 http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
     <div class="container">
        <h1><div  id="button" class="button">button</div></h1>
     </div>
</body>
<script src="app.js"></script>
</html>

CSS


body{
    margin: 0;
    padding: 0;
    background-color: #000;
}
.container{
    top: 50%;
    left: 50%;
    position: absolute;
    transform:translate(-50%, -50%);
}
.button{
    position: relative;
    width:250px ;
    padding: 40px ;
    text-align: center;
    font-size: 35x;
    font-family: poppins;
    color: #15f4ee;
    font-weight: 400;
    border: 5px solid #15f4ee;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 15px;
    border-radius: 100px;
    transition: 1.5s;
}
.button:hover{
    box-shadow: 0 5px 50px 0#15f4ee inset, 0 5px 50px 0#15f4ee,
               0 5px 50px 0#15f4ee inset, 0 5px 50px 0#15f4ee;
    text-shadow:  0 5px 5px 0#15f4ee, 0 5px 5px 0#15f4ee;  
}
@keyframes spin {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
  
  .spin {
    animation: spin 0.1s infinite linear;
  }

JavaScript

document.getElementById('button').addEventListener('click', function() {
    // Change the button text when clicked
    this.innerText = 'Clicked!';

    // Change the background color after 1 second
    setTimeout(function() {
      document.getElementById('button').style.backgroundColor = '#373737';
    }, 1000);
    
    setTimeout(function() {
      document.getElementById('button').classList.add('spin');
    }, 3000);

    setTimeout(function() {
      document.getElementById('button').classList.remove('spin');
    }, 4000);

  });