How to use the CSS button generator
- Start from a preset in the gallery or keep the default. Filter by style (minimal, glass, neon, 3D and more) and select Customize to load one into the controls.
- Choose a variant, button text, icon and size scale under Style & content and Size & typography.
- Shape it with corner radius (all corners or each one), border width, style and color.
- Color it with a solid fill or a linear, radial, conic or animated gradient, and add up to four shadow layers.
- Design the states: how the button reacts on hover and press, its focus ring, and how it looks when disabled. The state row under the preview shows them all at once.
- Add motion with one of 35+ effects and set the duration and easing. Choose Custom curve to drag the cubic-bezier handles or nudge them with the arrow keys.
- Check accessibility, then copy or download the code in the format you need. Use Undo and Redo (Ctrl+Z / Ctrl+Shift+Z) freely, and Save as A to compare two versions side by side.
How it works: what the CSS does
Each design becomes one class, .btn, plus state selectors:
:hover:not(:disabled)changes the button only when it can actually be pressed.:focus-visibledraws an outline ring for keyboard users. The ring usesoutlinewith anoutline-offset, so it never changes the layout.:active:not(:disabled)gives the press feedback, usually a slight scale or a downward move.:disabledand[aria-disabled="true"]reduce opacity and show a not-allowed cursor.[aria-busy="true"]marks a loading button.
Effects that need an extra layer use ::before or ::after pseudo-elements, such as the shine sweep, the fills and the ripple. The button then gets position: relative and, where needed, overflow: hidden, and its content is lifted above the effect layer so the label stays readable. Animated effects add @keyframes named after the class to avoid clashes.
Every export ends with a prefers-reduced-motion block that turns transitions and animations off for people who ask their device to reduce motion.
Browser support and performance
Everything here works in current versions of Chrome, Edge, Firefox and Safari. backdrop-filter (glass) is supported in all of them, and the export includes the -webkit- prefix for older Safari. The generated transitions animate only transform, opacity, filter, box-shadow and colors. Transform and opacity are composited by the GPU and stay smooth; large animated shadows and filters cost more, so keep them for buttons rather than whole sections.
Worked examples
Example 1: a primary call to action
Load Solid · Indigo, keep the Lift effect and set the size to LG. The button gets a 3:1-plus focus ring, a raised hover shadow and a 0.98 press scale. The contrast check shows white on indigo at about 6.3:1, comfortably above the 4.5:1 AA requirement.
Example 2: a glass button over a photo
Load Glass · Sky, switch the preview background to Image and add the Spotlight effect. The background is translucent with backdrop-filter: blur(12px). Watch the contrast check: translucent buttons depend on what’s behind them, so test them on the real background.
Example 3: a Shopify “Add to cart” button
Load 3D press · Emerald, set the text to “Add to cart” and choose the cart icon. The Shopify Liquid tab produces a snippet you can save as snippets/atx-button.liquid and render with a label and URL. The 3D press uses a hard bottom shadow that collapses when pressed.
Common mistakes
- Removing the focus outline.
outline: nonewithout a replacement makes the button unusable with a keyboard. The generator always keeps a ring. - Low-contrast hover states. A lighter hover color can drop below 4.5:1. Preview the hover state and check the ratio.
- Tiny touch targets. Icon-only buttons in particular often end up under 44px. Keep the minimum height at 44px for touch.
- Animating layout properties. Animating width, height or padding causes layout work on every frame. Use transform and opacity instead.
- Using a
divas a button. Always use<button>(or<a>for navigation) so keyboard and screen-reader support come for free.
Import CSS from your site
Already have a style you like? Open Import CSS (copy from a site), paste a rule or just its declarations from your stylesheet or your browser’s developer tools, and press Import into the controls. This tool reads background (colors and gradients), color, border, border-radius, padding, font size, weight, family and letter-spacing, text-transform, height, width, box-shadow and transition duration. Everything else, and rules for states such as :hover or media queries, is listed as skipped, and the import can be undone in one step.