CSS & Design
CSS Button Generator
Design a styled button with hover and copy the CSS.
Free browser toolRuns in your browserNo sign-up
.button {
background: #1B5DF5;
color: #FFFFFF;
padding: 12px 20px;
border-radius: 10px;
font-size: 16px;
font-weight: 600;
border: none;
cursor: pointer;
box-shadow: 0 8px 20px -6px #1B5DF580;
transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover {
transform: translateY(-1px);
filter: brightness(1.05);
}About the CSS Button Generator
A good button needs the right colour, padding, radius and a subtle hover effect. Hand-tuning all of that in code is slow.
This generator gives you controls for every property with a live button preview, then outputs clean CSS including a hover state.
It runs in your browser.
Key features
- Colour, padding, radius and font size
- Optional drop shadow
- Includes a hover effect
- Copy the button CSS
How to use
- 1Adjust the colours and sizing.
- 2Toggle the shadow.
- 3Copy the CSS.
- 4Apply class="button" to your own button or link and paste both the base and :hover rules. Padding X controls left/right padding, while Padding Y controls top/bottom padding.
- 5The on-page button previews the base appearance. Test the exported hover rules in your project; the generator's preview does not apply the copied .button:hover selector.
- 6Add and test focus-visible, disabled and active states for your real control, and check its text contrast. Those states and checks are not generated here.
Examples
Primary button
Output:
background: #1B5DF5; border-radius: 10px; padding: 12px 20px;A solid colour with rounded corners and comfortable padding makes a clear primary button.
Frequently asked questions
- Does it include a hover state?
- Yes. The exported .button:hover rule lifts the button by 1px and applies brightness(1.05). The transition covers transform and box-shadow, so the brightness filter is not itself included in that transition.
- Can I use it for links?
- Yes. Apply the .button class to an anchor or button element. Anchors may also need display and text-decoration rules in your project, and styling a link does not change its semantics.
- How do I change the hover colour?
- The hover uses a brightness filter so it adapts to your background colour. Edit the :hover rule for a specific colour.
Continue your workflow
Open a related tool to prepare your files or refine the finished result.
- CSS & DesignBorder Radius Generator
Design rounded corners with per-corner sliders and copy the CSS.
Open tool - CSS & DesignCSS Box Shadow Generator
Design a CSS box shadow with sliders and copy the CSS.
Open tool - CSS & DesignCSS Transition Generator
Build a CSS transition with a live hover preview and copy the CSS.
Open tool
