CSS button generator
Tune a button in the browser and get complete CSS: solid or gradient background, text color, size and weight, padding, radius, border, shadow, plus hover, active and disabled states with a real transition curve and a hoverable preview.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Presets
Background
Size and border
Interaction states
Button preview
Hover the button and hold the mouse down to see the real hover and active states; tick the switch below for disabled.
Current state: normal · Rule blocks: 4
Generated CSS
Contains the .button rule plus :hover, :active and :disabled, ready to copy.
.button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 24px;
font-size: 16px;
font-weight: 600;
color: #ffffff;
background: #2563eb;
border: 0;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
cursor: pointer;
transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.button:hover {
filter: brightness(1.08);
box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.button:active {
transform: translateY(1px);
filter: brightness(0.96);
}
.button:disabled {
opacity: 0.55;
cursor: not-allowed;
filter: none;
}What this tool does
- Prototype a button fast: background (solid or gradient), font size and weight, padding, radius, border, shadow, then copy CSS with all states
- Polish the hover, active and disabled details: brightness, press shift, disabled opacity, transition duration and easing
- Move design-spec values into code: enter colors as #hex or rgba and shadows with the specified Y offset, blur and color
Example
Input
Solid background #2563eb · text #ffffff · 16px/600 · padding 12px 24px · radius 8px · shadow 0 4px 12px rgba(37, 99, 235, 0.35) · transition 300ms cubic-bezier(0.4, 0, 0.2, 1)
Output
.button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 24px;
font-size: 16px;
font-weight: 600;
color: #ffffff;
background: #2563eb;
border: 0;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
cursor: pointer;
transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.button:hover {
filter: brightness(1.08);
box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.button:active {
transform: translateY(1px);
filter: brightness(0.96);
}
.button:disabled {
opacity: 0.55;
cursor: not-allowed;
filter: none;
}This is the real output for the page defaults; change any parameter and both the CSS and the preview update.
Frequently asked questions
Which color formats are supported?
The #rgb, #rgba, #rrggbb and #rrggbbaa notations, rgb() / rgba(), and the 16 basic CSS color keywords (black, white, red, transparent and so on). hsl(), named colors such as rebeccapurple and gradient keywords report invalid-color instead of silently falling back, so the CSS never contains a value the browser rejects.
How are the hover, active and disabled states computed?
hover uses filter: brightness(hover value) and deepens the shadow (Y offset +2px, blur +4px) when a shadow is enabled; active uses translateY(shift) plus brightness(active value); disabled uses opacity plus cursor: not-allowed and filter: none. Brightness, shift and opacity are adjustable and are written straight into the :hover, :active and :disabled rules.
Do the preview and the generated CSS share the same data?
Yes. The preview button style comes from buttonStateStyle and the CSS from buildButtonCss, both reading the same validated parameters. Hovering and holding the mouse switches the preview to the real hover and active states, and a switch previews disabled, so the preview cannot disagree with the code.
Which class name is generated?
The page emits .button for easy pasting, and the pure function buildButtonCss accepts a second selector argument (a class selector starting with a dot) if you need a different name. This tool generates CSS only, not the HTML markup.
Can the radius make a pill button?
Yes, radius goes up to 999px, and 999 gives a pill (that is what the gradient pill preset uses). With border width 0 the output is border: 0, so no default border leaks in.
Keywords:box-shadowCSS button generatorcss_buts