Skip to content
Jellykit

CSS Button Generator

Design solid, outline, soft or neo-brutal buttons with hover, pressed and focus states, then copy the CSS.

  • Runs on your device
Loading tool

About CSS Button Generator

Start from one of four styles, set your main color, and shape the button with corner radius, padding, font size and weight. The preview shows the button at rest, hovered and pressed side by side, so you can judge every state without reaching for a mouse.

Text color is chosen for you from the background unless you set your own, and the tool reports the WCAG contrast of the resting text so you know whether it is readable. The CSS includes a visible keyboard focus ring that stands out from your page color.

How it works

  1. Each style is a set of CSS declarations for four selectors: the button itself, :hover, :active for the pressed state, and :focus-visible for keyboard focus.
  2. Hover and pressed colors are worked out from the main color: solid buttons darken, soft buttons deepen their tint, outline buttons fill in, and neo-brutal buttons lift off and then press into their hard shadow.
  3. Automatic text color compares the WCAG contrast of near-black and white against the button and keeps whichever is higher. Contrast is reported rounded down, so a figure shown as passing really passes.
  4. The focus ring uses the main color when it contrasts at least 3:1 with the page, and near-black or white otherwise.

Questions

Which element should I put the class on?

A real button element, or a link when it navigates. The CSS sets display: inline-flex, so it also centres an icon placed next to the text.

Why does the outline button warn about contrast?

An outline button shows its main color as text on your page color. Pale colors such as yellow on white are hard to read, so the tool warns when the ratio falls below the 4.5:1 that WCAG AA asks for normal-size text.

Are the hover effects safe for touch screens?

Yes. Nothing depends on hover: it only adds feedback. The pressed state uses :active, which phones and tablets show while a finger is on the button.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.