Thick borders, hard shadows, press states and a text contrast check
CSS Button Generator
Get a complete button style, every state included, with a label colour that passes contrast.
Loading tool…
How to use css button generator
Pick a preset or a variant: solid, outline, soft, ghost or gradient.
Set the brand colour, padding, radius, font size and weight.
Choose a hover effect (darken, lift or glow) and try it in the preview.
Check the contrast read-out, then copy the CSS or the Tailwind classes.
What this tool does
- Generates hover, active, focus-visible and disabled states plus a reduced motion rule.
- Can choose black or white label text automatically from the fill colour.
- Checks label contrast against the fill, both gradient ends, or the page for outline and ghost buttons.
- Shows each button on light and dark backgrounds with a disabled copy beside it.
How the result is verified
The preview buttons are styled by the generated rules, so hovering, tabbing to and clicking them tests the real CSS. Contrast uses the WCAG 2 formula.
Frequently asked questions
Why use focus-visible instead of focus?
focus-visible shows the ring when someone moves with the keyboard but not after a mouse click, which keeps buttons accessible without a ring flashing on every click.
How is the label colour chosen?
With automatic text on, the tool compares black and white against the fill and keeps whichever has the higher contrast ratio.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Layered box-shadow builder with presets, inset and Tailwind output
Per-corner and elliptical border-radius with shortest shorthand output
Soft UI shapes for light and dark mode with a WCAG text contrast check