20 CSS Animated Buttons

10 Pure CSS10 Light JSPublished

20 CSS animated buttons for form submits, add-to-cart and download flows, loading and success states, hamburger and toggle switches, and social share rows — spanning neon glow, ripple, liquid fill, moving gradients, shine sweeps, jelly bounces, text flips, 3D presses, and ghost reveals. Scoped under .ab-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.

Related51 CSS Buttons36 CSS Button Hover Effects22 CSS Gradient Buttons20 Tailwind CSS Animated Buttons

Course pickPartner: Zero to Mastery

Affiliate link

Want to build production-ready CSS layouts, animations and UI from scratch?

You just browsed 20 buttons. Learn the Flexbox, Grid and animation thinking behind them, so the next component starts in your head, not in a copy-paste.

10% off at checkout with code
Check ZTM Course

Every ZTM course in one membership: $25/month, paid yearly at $299 · 30‑day money-back guarantee

The CSS Bootcamp. We may earn a commission, at no extra cost to you.

Newsletter

Enjoying these demos? Get new ones by email.

A short email when a new collection ships. Unsubscribe any time.

at

Almost there: check your inbox to confirm.Manage

Newsletter

Enjoying these demos? Get new ones by email.

A short email when a new collection ships. Unsubscribe any time.

at

Almost there: check your inbox to confirm.Manage

FAQ

Frequently asked questions

What's the difference between CSS animated buttons and CSS hover button effects?
Hover effects are limited to what happens while the cursor is OVER the button — a fill slides in, a border draws, a glow ramps up. Animated buttons are broader: they cover hover, but also active/press states (3D press, ripple from click point), result states (submit success checkmark, add-to-cart progress fill), idle attention (jelly bounce, shine sweep), and stateful toggles (hamburger ↔ close, toggle switch flip). This collection covers all of them. If you only want hover-state effects, see our separate /motion/css-button-hover-effects/ collection. Use this one when the button needs to animate during a real interaction, not just on hover.
Which of these CSS animated buttons work without JavaScript?
Half of them — 10 of 20. The Pure CSS demos cover: neon glow, background slide, pure-CSS ripple (uses ::after expanding from center), animated border draw, 3D press, liquid fill, moving gradient CTA, shine sweep, jelly bounce, and text flip. Each is tagged 'Pure CSS' on its card. The other 10 use a small vanilla-JS snippet for genuinely interactive state — submit-button success animation that fires on form submit, add-to-cart progress that runs once on click, hamburger-to-close toggle, toggle switch, loading spinner that you start/stop programmatically, etc. The JS lives in the demo's JS tab — every byte you need is in the code panel.
How do you make a CSS ripple button without JavaScript?
Use an ::after pseudo-element absolutely-centered inside the button, scaled from 0 to 4× on :active with opacity fading from 0.4 to 0 in the same keyframe. Wrap the button in overflow: hidden so the ripple clips at the edge. The ripple emerges from the button's center — true click-point ripples (where the wave starts from the exact pixel the mouse hit) need ~10 lines of JS to set --x / --y CSS variables on click. The Pure CSS Ripple Effect Button (#03) in this collection ships the no-JS version; the production CTA Hero Button (#11) shows the JS-coordinated version with click-coordinate tracking.
How do you animate a submit button success state in CSS?
Three-stage animation: (1) the button enters a loading state when the form submits — text fades out, a CSS spinner fades in; (2) on resolved success, the spinner morphs into a checkmark using stroke-dasharray draw-in on an SVG path; (3) the button background animates to a success green and stays there briefly before resetting. The visible state machine is driven by a single data-state attribute on the button (data-state='idle' | 'loading' | 'success') and CSS rules keyed off that attribute — the JS just swaps the attribute value at the right moments. The Submit Button Success State demo (#12) in this collection ships the full recipe.
How do you animate an add-to-cart button in CSS?
The pattern most e-commerce sites use: the button's width expands slightly on click, a progress bar runs across its background via animated linear-gradient or a scaling ::before, and on completion a checkmark + 'Added' label fade in to replace the original 'Add to cart' label. For a richer version, a small product icon arcs into the cart icon at the top of the page using CSS keyframes — but that's overkill for most uses. The Add To Cart Button Animation demo (#15) in this collection ships the standard recipe (progress bar + label swap).
How do you keep CSS button animations at 60fps?
Animate only transform and opacity. Both are compositor-only properties that bypass the layout and paint phases, so the browser hits 60fps even on lower-end devices. Avoid animating width, height, top, left, padding, or box-shadow size on the active transition (they trigger layout reflow and cost dozens of milliseconds per frame). For longer animations like a glow pulse or jelly bounce, add will-change: transform to the button (NOT its parent) and remove it when the interaction ends to free the compositor layer. Every demo in this collection follows these rules — that's what makes them feel snappy rather than laggy.
Are these CSS animated buttons accessible and mobile-friendly?
Yes. Every demo wraps continuous animations in @media (prefers-reduced-motion: reduce) so users who opt out (vestibular sensitivity, migraine triggers — about 35% of adults have some motion preference) get an instant state change instead of motion. On touch devices :hover falls back to :active so press / feedback effects still fire on tap. Every button is a real <button> element with a visible :focus-visible outline so keyboard users see the same affordance as mouse users — and the focus ring stays visible even when the hover effect plays. WCAG 2.2 non-text contrast (3:1) is met on every visible state.
Are these CSS animated buttons free for commercial use?
Yes. Every demo is MIT licensed — free for personal and commercial use, no attribution required, no signup, no upgrade tier. Copy the HTML + CSS (+ JS, for the production demos) from the code panel and paste into your project. There's no watermark in the output. Use these on a client project, a SaaS marketing site, an enterprise dashboard — none of those need permission.

Related collections

11 CSS animation-timeline Demos preview

11 CSS animation-timeline Demos

11 pure CSS animation-timeline demos built on the W3C scroll() and view() spec — reading progress bar, view-timeline fade & reveal, shrinking sticky header, stacking cards, horizontal scroll section, parallax hero, container shadow indicators, reverse-scroll columns, text scrim reveal, cover card to sticky header, and image zoom / clip-path wipe. Zero JS, off the main thread, Core Web Vitals safe. Copy-paste ready.

25 CSS Background Animations preview

25 CSS Background Animations

25 hand-coded CSS background animations for SaaS hero sections, developer tool documentation, agency portfolios, gaming and Web3 landing pages, seasonal e-commerce campaigns, and dark-mode dashboards. Covers full-screen gradient shifts, animated mesh gradients, aurora borealis glow, cursor spotlight follow, interactive water ripples, dot grid and diagonal stripe patterns, SVG grain and noise texture overlays, topographic contour lines, layered SVG waves, plasma and lava lamp fluids, bokeh light blur, particle constellation networks, matrix digital rain, synthwave 3D perspective grids, starfield warp speed, CRT scanline overlays, fog and mist drift, morphing organic blobs, floating glassmorphism orbs, halftone dot patterns, starry night skies, floating geometric shapes, rising bubbles, and falling snow. 20 are pure CSS with zero JavaScript; the 5 that need it use vanilla canvas or pointer tracking with no dependencies. Every background animates compositor-only properties so it never blocks the main thread, is scoped under a .bga-NN prefix for no-collision pasting, guards prefers-reduced-motion, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.

16 CSS Bounce Animations preview

16 CSS Bounce Animations

16 hand-coded CSS bounce animation templates built as real-world use cases — landing-page scroll-down arrow, animate.css-style bounce-in entrance modal, Stripe payment success checkmark, Sonner/Radix toast notification, chat typing dots (wave), button hover bounce, SaaS pricing card hover lift, Shopify Add-to-Cart cart-icon shake, notification badge pop, dark-mode toggle switch elastic snap, physics ball with squash-and-stretch, weightless floating badge, bouncing letters wave, Stripe checkout form error alert shake, DVD screensaver viewport bounce, and Tailwind <code>animate-bounce</code> customization. Every bounce animates <strong>only <code>transform</code> and <code>opacity</code></strong> — never <code>margin-top</code>, <code>top</code>, <code>width</code>, or <code>height</code>, which trigger the layout+paint pipeline every frame and tank INP scores. 12 pure CSS + 4 with vanilla JS (modal open/close, toast auto-cycle, cart bounce class toggle, error state toggle). Every demo respects <code>prefers-reduced-motion</code> with a tier-appropriate fallback — arrivals show settled state, interactions swap for instant color change, playful demos disable entirely. Scoped under <code>.bn-NN</code>, MIT-licensed.

Search CodeFronts

Loading…