ZapKit

CSS button generator

Style a button visually, try it with real hover and click states, and copy complete CSS, including a visible focus outline for keyboard users.

What is a CSS button generator?

A CSS button generator lets you design a button with controls instead of writing styles by hand. You see the result immediately, including how it reacts when hovered and clicked, then copy code that works in any website or framework.

Choose a solid colour or gradient, text colour, padding, font size and weight, corner radius, border and shadow, and whether it lifts on hover. Five presets cover common styles to start from. The CSS includes hover, active and keyboard focus states.

How to use the CSS button generator

  1. 1.Start from a preset

    Solid, pill gradient, outline, dark or brutal.

  2. 2.Style it

    Colours, padding, font size and weight, radius, border, shadow and hover effects.

  3. 3.Copy the CSS

    Normal, hover, active and focus-visible rules in one block.

Example: a primary action button

The Solid preset with the default sizes:

Background / text
#2547d0 / white
Padding
12px 24px
Font
16px, weight 600
Hover
10% darker, lifts 2px

A clear blue button that darkens and rises slightly on hover, with a blue focus ring for keyboard users.

All the states a button needs

A finished button needs more than a colour: a hover change so it feels clickable, an active state for the moment of the click, and a clear focus outline for people using a keyboard. The generated CSS includes all four, with smooth transitions.

The hover colour is worked out from your background automatically: most colours darken, while very dark buttons lighten so the change stays visible.

Frequently asked questions

Why is there a focus-visible rule?

It shows an outline when someone tabs to the button with a keyboard, without showing it on mouse clicks.

How do I make a pill button?

Drag Corner radius to the end; it becomes a fully rounded pill.

Can I use it on links?

Yes. Add the class to an a element and it looks the same.

Is the preview the real CSS?

Yes. The preview button uses exactly the CSS shown, so hover and click to test it.

More Developer tools