CSS Button Generator
About this tool
About CSS Button Generator
A good button is four designs in one: its normal look, what happens on hover, how it reacts when pressed, and a clear focus ring for keyboard users. This generator lets you edit each state separately and shows all four side by side, along with a live button you can hover, click and tab to. For normal, hover and active you set the background, text and border colours, a shadow style (soft, medium, hard offset or a glow in the fill colour) and a lift that moves the button up or down. The focus tab sets the outline colour, width and offset for :focus-visible. Shared settings cover padding, corner radius up to a full pill, border width, font size, weight, uppercase and transition speed. Presets include Primary, Outline, Pill, Brutal, Glow and Soft. The CSS only repeats properties that actually change in each state, and you also get Tailwind classes and HTML. Nothing leaves your browser. A gallery of 24 button templates, from primary and outline to destructive, terminal and luxury, sets every state at once while keeping your label. Optional AI assist can style every state from a brand description, using your own AI key.
Built and maintained by Abhi JainUpdated
How to Create a CSS Button
- 1
Pick a preset
Start from Primary, Outline, Pill, Brutal, Glow or Soft, and type your button text.
- 2
Edit each state
Use Edit state to switch between Normal, Hover, Active and Focus, and adjust the colours, shadow, lift and focus ring.
- 3
Set shape and type
Adjust padding, corner radius, border width, font size, weight and transition.
- 4
Copy the code
Copy the CSS, Tailwind classes or HTML, or download the CSS file.
CSS Button Generator: questions and answers
What is the difference between :focus and :focus-visible?
:focus applies whenever the button has focus, including after a mouse click. :focus-visible applies only when the browser decides a visible indicator helps, mainly keyboard navigation, so mouse users don't see a ring after clicking.
How do I add a hover effect to a button in CSS?
Add a .btn:hover rule that changes the background, shadow or transform, and a transition on the base rule so the change animates. The generator writes both.
Why do buttons need a visible focus style?
Keyboard and switch users need to see which control is active. WCAG 2.2 requires a visible focus indicator, and removing outlines without a replacement fails it.
How do I make a pill-shaped button?
Drag the corner radius to the end of the slider (pill). It sets a very large radius, which the browser caps at half the button's height.
Can AI help me design a button?
Yes, optionally. Click AI and describe the brand or style; it suggests colours for each state, shape and type settings and a label, which you apply and then fine-tune. It runs on your own AI key; only your description and current settings are sent, directly from your browser to your provider. Check the text contrast before shipping.
Are there ready-made button styles?
Yes, 24 templates grouped like a UI kit: primary, secondary (outline, soft, ghost, neutral), status (destructive, success, warning), expressive, dark mode, compact and premium. Each defines normal, hover, active and focus states, keeps your own button text, and every state passes WCAG AA text contrast.
Related Tools
- Neo-Brutalism GeneratorBold borders, hard offset shadows and flat colour, as CSS or Tailwind.
- Box Shadow GeneratorLayered CSS box shadows with inset, presets and a live preview.
- Color Contrast CheckerCheck WCAG 2.2 AA and AAA contrast for text and UI, and get the nearest passing colour.
- Border Radius GeneratorPer-corner and elliptical CSS border-radius, including blob shapes.