Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body class="transition-colors duration-300">
  <div class="min-h-screen p-8" id="main-container">
    <!-- Header with Dark Mode Toggle -->
    <div class="max-w-4xl mx-auto mb-8 flex justify-between items-center">
      <a href="https://abhirajk.vercel.app" class="text-2xl font-bold hover:text-blue-500 transition">
        Abhiraj K
      </a>
      <button onclick="toggleTheme()" class="p-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition">
        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
        </svg>
      </button>
    </div>

    <div class="max-w-4xl mx-auto">
      <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
        <!-- Circle Spinner -->
        <div class="spinner-card bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg flex flex-col items-center space-y-4">
          <h2 class="font-semibold text-lg dark:text-white">Circle Spinner</h2>
          <div class="border-4 border-blue-500 dark:border-blue-400 rounded-full w-12 h-12 spinner-circle"></div>
          <button class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition">
            Loading...
          </button>
        </div>

        <!-- Dots Spinner -->
        <div class="spinner-card bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg flex flex-col items-center space-y-4">
          <h2 class="font-semibold text-lg dark:text-white">Dots Spinner</h2>
          <div class="dots-container">
            <div class="dot bg-purple-500 dark:bg-purple-400"></div>
            <div class="dot bg-purple-500 dark:bg-purple-400"></div>
            <div class="dot bg-purple-500 dark:bg-purple-400"></div>
          </div>
          <button class="px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition">
            Processing...
          </button>
        </div>

        <!-- Pulse Spinner -->
        <div class="spinner-card bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg flex flex-col items-center space-y-4">
          <h2 class="font-semibold text-lg dark:text-white">Pulse Spinner</h2>
          <div class="w-12 h-12 rounded-full bg-green-500 dark:bg-green-400 pulse"></div>
          <button class="px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition">
            Updating...
          </button>
        </div>

        <!-- Wave Spinner -->
        <div class="spinner-card bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg flex flex-col items-center space-y-4">
          <h2 class="font-semibold text-lg dark:text-white">Wave Spinner</h2>
          <div class="wave-container">
            <div class="wave-bar bg-red-500 dark:bg-red-400"></div>
            <div class="wave-bar bg-red-500 dark:bg-red-400"></div>
            <div class="wave-bar bg-red-500 dark:bg-red-400"></div>
            <div class="wave-bar bg-red-500 dark:bg-red-400"></div>
            <div class="wave-bar bg-red-500 dark:bg-red-400"></div>
          </div>
          <button class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition">
            Syncing...
          </button>
        </div>
      </div>

      <!-- Footer with Backlinks -->
      <footer class="mt-12 text-center">
        <p class="text-gray-600 dark:text-gray-400">
          Created by
          <a href="https://abhirajk.vercel.app" class="text-blue-500 hover:text-blue-600 transition font-medium">
            Abhiraj K
          </a>
          • View more projects on
          <a href="https://abhirajk.vercel.app" class="text-blue-500 hover:text-blue-600 transition font-medium">
            Portfolio
          </a>
        </p>
      </footer>
    </div>
  </div>

  <script>

  </script>
</body>

</html>
              
            
!

CSS

              
                /* Base styles and dark mode */
:root {
  --primary: #3b82f6;
  --background: #ffffff;
  --text: #1f2937;
}

[data-theme="dark"] {
  --primary: #60a5fa;
  --background: #1f2937;
  --text: #f3f4f6;
}

/* Circle Spinner */
.spinner-circle {
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dots Spinner */
.dots-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
  animation-delay: -0.32s;
}
.dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Pulse Spinner */
.pulse {
  animation: pulse 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

/* Wave Spinner */
.wave-container {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  height: 2rem;
}

.wave-bar {
  width: 0.25rem;
  height: 100%;
  animation: wave 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(2) {
  animation-delay: 0.1s;
}
.wave-bar:nth-child(3) {
  animation-delay: 0.2s;
}
.wave-bar:nth-child(4) {
  animation-delay: 0.3s;
}
.wave-bar:nth-child(5) {
  animation-delay: 0.4s;
}

@keyframes wave {
  0%,
  40%,
  100% {
    transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1);
  }
}

/* Floating animation for cards */
.spinner-card {
  transition: all 0.3s ease;
}

.spinner-card:hover {
  transform: translateY(-5px);
}

              
            
!

JS

              
                // Dark mode toggle functionality
function toggleTheme() {
  const html = document.documentElement;
  const currentTheme = html.getAttribute("data-theme");
  const newTheme = currentTheme === "dark" ? "light" : "dark";
  html.setAttribute("data-theme", newTheme);

  // Toggle dark mode classes
  document.body.classList.toggle("bg-gray-900");
  document.body.classList.toggle("text-white");
}

// Check system preference for initial theme
if (
  window.matchMedia &&
  window.matchMedia("(prefers-color-scheme: dark)").matches
) {
  document.documentElement.setAttribute("data-theme", "dark");
  document.body.classList.add("bg-gray-900", "text-white");
}

              
            
!
999px

Console