JSFiddle - React, Tailwind, and code Playground

by ckissi

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://unpkg.com/tailwindcss/dist/tailwind.min.css">
  <link rel="stylesheet" href="styles.css">
  <title>Animated Button</title>
</head>

<body>
  <button class="animated-button">Click me</button>

  <script src="https://unpkg.com/tailwindcss/dist/tailwind.min.js"></script>
</body>

</html>

CSS

/* Custom CSS for the animated button */
@keyframes pulsate {
  0% {
    background-color: #3490dc;
  }
  50% {
    background-color: #2779bd;
  }
  100% {
    background-color: #3490dc;
  }
}

@keyframes border-highlight {
  0% {
    border-color: #3490dc;
  }
  50% {
    border-color: #2779bd;
  }
  100% {
    border-color: #3490dc;
  }
}

.animated-button {
  padding: 1rem 2rem;
  font-size: 1.2rem;
  border-radius: 0.5rem;
  background-color: #3490dc;
  color: white;
  border: 2px solid #3490dc;
  cursor: pointer;
  animation: pulsate 1s infinite, border-highlight 1s infinite;
}

.animated-button:hover {
  animation: none; /* Stop the animations on hover */
  background-color: #2779bd;
  border-color: #2779bd;
}