Skip to main content
BestDesignTools

Free browser tool

CSS Button Generator

Tune a button’s shape and colour, preview its hover state, and copy the CSS rules.

Generated CSS

How to use the CSS button generator

Start by choosing a base colour and a separate hover colour with the colour pickers. The preview updates immediately, giving you a quick way to check contrast and see how the button feels against a neutral background. Move the pointer over the preview to see the hover colour. Pick colours that are consistent with your site’s palette and keep the button label legible against its background.

Adjust padding and shape

Use horizontal padding to control the space at the left and right of the label, and vertical padding to control the top and bottom. The range controls show their current values in pixels. More padding can make a button easier to tap, while a smaller setting creates a compact control for a dense interface. Adjust the corner radius to create a square, softly rounded, or pill-like shape that matches nearby components.

Add a shadow and hover treatment

Select no shadow, a subtle shadow, or a raised shadow. A restrained shadow can separate a primary action from the page, but avoid using it if the rest of your interface is flat. The generated hover rule changes the background colour and includes a short transition. This gives users a visible response when they point at the button while keeping the interaction simple.

Copy the CSS into your project

Choose “Copy CSS” to copy both the base class and its hover rule. Add the output to a stylesheet, CSS module, or prototype, then apply the generated-button class to a button element. The output is intentionally plain CSS: you can rename the class, convert fixed pixel values to your design tokens, or add focus-visible and disabled styles to meet your project’s accessibility and interaction requirements.

Review the button in context

A button can look different beside real content than it does in an isolated preview. Check the final result at the widths and text sizes your site supports. Make sure the hover state is not the only feedback: keyboard users need a clear focus style, and touch users do not have a hover state. This tool runs entirely in your browser; its settings are not uploaded.

Find more design software and resources in the design tool directory.