Every project needs buttons, and hand-coding a good one — hover state, animation, accessibility and all — eats more time than it should. Below are 8 free button snippets you can preview live and copy in seconds. Each one is pure HTML, CSS and (where needed) a few lines of JS, with no framework required.
But this isn't just a copy-paste dump. For every button you'll find how the effect actually works, when to reach for it (and when not to), and a quick tip for customising or keeping it accessible. By the end you'll not only have eight buttons — you'll understand the handful of CSS and JavaScript techniques that power almost every button micro-interaction on the modern web.
Every button below is a live, interactive preview — hover it, click it, try it right in the article. When you find one you like, hit View / Edit Code to grab the HTML/CSS/JS or export it to React, Vue, Angular or Tailwind.
What makes a button feel "good"?
Before the snippets, it helps to know what you're actually copying. A button that feels satisfying almost always gets four things right:
- Instant visual feedback — hover, focus and active states that respond in under 200 ms so the button feels connected to your cursor.
- Motion with purpose — animation that guides attention to the primary action, not decoration for its own sake.
- Performance — effects built on
transformandopacity(which the GPU handles) rather than properties that trigger expensive layout repaints. - Accessibility — real
<button>elements, visible focus rings, and respect forprefers-reduced-motionso animation never becomes a barrier.
Keep those four in mind as you scroll — each snippet below leans on one or more of them.
1. Gradient Button
Three animated CSS gradient buttons — a moving gradient, a shine sweep, and a gradient border — with hover lifts and zero JavaScript. It's the fastest way to make a call-to-action feel premium.
How it works: the moving gradient sets a background-size larger than the button (e.g. 200%) and animates background-position, so the colours slide across a fixed frame. The gradient border uses a ::before pseudo-element sized slightly larger than the button, sitting behind it — a trick that dodges the fact that border-image can't be rounded.
Best for: hero calls-to-action, pricing "Get started" buttons, and SaaS landing pages where the primary action needs to feel high-value. Tip: swap the two gradient stops for your brand colours and keep the animation duration around 3–4 s — faster than that reads as jittery rather than premium.
Grab the code: Gradient Button
2. Ripple Button
A Material-style ripple that expands from the exact click position in about 10 lines of JS. Comes in solid and outline variants, and exports cleanly to React, Vue and Tailwind.
How it works: on click, the script reads the button's position with getBoundingClientRect(), subtracts it from the cursor coordinates to find the exact origin, and drops in a <span> that a CSS keyframe scales up and fades out. The element removes itself when the animation ends, so clicks never pile up stray nodes in the DOM.
Best for: app UIs, dashboards, and anything with a Material or Android feel where users expect touch feedback. Tip: the ripple is the single most recognisable "this is interactive" cue you can add — it works beautifully on cards and list items too, not just buttons.
Grab the code: Ripple Button
3. Shimmer Button
A rotating conic spark border, a sheen sweep on hover, and a click ripple — all GPU-light so it stays smooth on mobile. Perfect for a hero CTA that needs to catch the eye.
How it works: the animated border is a conic-gradient rotated with a CSS custom property (@property --angle) so the browser can animate the angle on the GPU. The sheen is a diagonal light-coloured gradient that slides across on hover using a transform: translateX() transition — no repaint, no jank.
Best for: a single, unmissable primary action — a "Start free trial" or "Buy now" hero button. Tip: use shimmer sparingly. One shimmering button on a page pulls the eye; three of them compete and cancel each other out.
Grab the code: Shimmer Button
4. Neon Glow Buttons
Cyberpunk neon buttons built from layered box-shadow and text-shadow in cyan, pink, green and purple — pure CSS, no images. Great for dark-themed landing pages and gaming sites.
How it works: the glow is several box-shadow layers stacked in the same hue — a tight, bright inner shadow for the core and progressively wider, softer shadows for the ambient spread. On hover the shadow radii grow, so the button appears to "light up". A matching text-shadow makes the label glow too.
Best for: dark UIs, gaming and crypto sites, music and event pages, and developer tools with a terminal aesthetic. Accessibility note: neon only reads well on a dark background — check that your label still hits a 4.5:1 contrast ratio, because pure glow can leave the core text hard to read.
Grab the code: Neon Glow Buttons
5. Magnetic Button
This button pulls toward the cursor using a little vector math and getBoundingClientRect, then smoothly snaps back when you leave. It's the kind of micro-interaction that makes a portfolio feel expensive.
How it works: on mousemove, the script measures the distance from the cursor to the button's centre and applies a proportional translate so the button drifts toward the pointer. A requestAnimationFrame loop eases the movement (a lerp — linear interpolation) so it glides rather than snapping, and resets to zero on mouseleave.
Best for: portfolios, agency sites, and premium product pages where craft is part of the pitch. Tip: keep the pull radius small (roughly the button's own size) and skip it on touch devices — there's no cursor to attract to, so gate it behind a (hover: hover) media query.
Grab the code: Magnetic Button
6. Liquid Button
The fill rises as gooey metaballs that merge into one liquid mass on hover, using an SVG goo filter. It's a showstopper for creative agency sites and product launches.
How it works: the "goo" is an SVG filter that blurs the shapes, then cranks up the alpha contrast so blurry edges snap back into a single crisp outline — blobs that overlap visually fuse. Small circles animate upward behind the label, and the filter makes them read as one rising liquid.
Best for: a single hero moment — a launch page, an award-style portfolio, a creative agency landing. Heads-up: SVG filters are the heaviest effect here, so use one instance, not a grid of them, and always provide a plain hover fallback for reduced-motion users.
Grab the code: Liquid Button
7. 3D Push Button
A tactile 3D push button in pure CSS — the top face drops onto a darker shadow face on click, exactly like pressing a real key. Simple, satisfying, and framework-friendly.
How it works: a darker element sits directly behind the button as its "base". The face is pushed up with translateY, exposing the base as a 3D edge. On :active the face translates down to meet the base, so the depth collapses — the exact motion of pressing a physical key. It's all transform, so it stays perfectly smooth.
Best for: games, kids' products, playful brands, and any interface where a chunky, physical feel fits. Tip: because it's pure CSS with a real :active state, it works on touch out of the box and needs zero JavaScript — one of the most robust snippets in this list.
Grab the code: 3D Push Button
8. Pulse Button
A call-to-action button that emits staggered expanding pulse rings to draw the eye, with a live/stop toggle and off-screen pausing so it never wastes battery. Ideal for "Sign up" or "Buy now".
How it works: the rings are pseudo-elements that scale up and fade out on a loop, each with a staggered animation-delay so a new ring leaves before the last one finishes — the classic "radar" pulse. An IntersectionObserver pauses the animation when the button scrolls out of view, which keeps it off the CPU and easy on battery.
Best for: the one action you most want clicked — "Sign up", "Buy now", a notification dot, or a chat launcher. Tip: a pulse is a strong attention magnet, so limit it to a single element per screen and pair it with clear, benefit-led label text.
Grab the code: Pulse Button
How to drop these into your project
Every snippet is framework-agnostic, so the workflow is the same wherever you're building:
- Open the snippet and hit View / Edit Code to see the HTML, CSS and JS in separate tabs.
- Paste the HTML into your markup, the CSS into your stylesheet, and the JS (if any) before your closing
</body>tag. - Prefer a component? Use the one-click export to React, Vue, Angular or Tailwind and drop the file straight into your app.
- Recolour to your brand by editing the gradient stops, accent colour, or CSS custom properties at the top of each snippet.
Keep your buttons accessible
Great visuals shouldn't cost you usability. Three quick rules cover almost every case:
- Use a real
<button>(or<a>for navigation) so keyboard and screen-reader users get the behaviour for free — never a bare<div>with a click handler. - Keep a visible
:focus-visibleoutline. If a design removes the default ring, add your own — keyboard users rely on it to see where they are. - Wrap heavier motion in
@media (prefers-reduced-motion: reduce)and fall back to a simple colour or shadow change for users who opt out of animation.
Final Thought
These are just 8 of dozens of button styles you can copy for free — no login, no sign-up, everything runs in your browser. More importantly, the techniques behind them — animated gradients, click-origin ripples, layered glows, lerped magnetic motion, SVG goo, 3D transforms and looping pulses — are the same building blocks you'll reuse across every interactive element you make. Learn them once here and you'll reach for them again and again.
Preview any of them live, tweak the code, and export to your framework of choice in one click. Browse the full collection at FWD Tools UI Snippets — Buttons — it's free and runs entirely in your browser.
.png)