CSS Button Generator
Design custom CSS buttons with live preview, hover effects, gradients, and presets
Text
Colors
Size & Padding
Border
Shadow
Hover State
Active State
Icon
Pick colors, padding, border-radius, shadows, hover effects, and gradients — then copy the finished CSS in one click. Every control updates the live preview instantly, so you skip the usual cycle of tweaking values in your editor and refreshing the browser. And everything runs in your browser. Nothing gets uploaded.
How It Works
Every slider, color picker, and dropdown triggers an instant CSS recalculation. The preview button at the top reflects your changes immediately — including hover and active states. When you're happy with the result, hit "Copy CSS" for just the stylesheet rules or "Copy HTML+CSS" if you want a ready-to-paste snippet.
Examples
Primary CTA for a SaaS landing page
You need a bold call-to-action that stands out against a white background.
Background: #6366f1
Text: #ffffff
Padding: 14px 32px
Border-radius: 8px
Shadow: 0 4px 14px rgba(99,102,241,0.4)
Hover: darken 10%
.btn {
background: #6366f1;
color: #fff;
padding: 14px 32px;
border-radius: 8px;
box-shadow: 0 4px 14px
rgba(99,102,241,0.4);
border: none;
cursor: pointer;
}
.btn:hover {
background: #4f46e5;
}
Outline button for a secondary action
Think "Cancel" or "Learn More" — visible but not competing with the primary button.
Background: transparent
Text: #374151
Border: 2px solid #d1d5db
Padding: 10px 24px
Border-radius: 6px
.btn {
background: transparent;
color: #374151;
border: 2px solid #d1d5db;
padding: 10px 24px;
border-radius: 6px;
cursor: pointer;
}
.btn:hover {
background: #f3f4f6;
}
Gradient pill button with icon for a mobile app promo
Marketing wants something "eye-catching" for the app download section. Gradient background, fully rounded corners, and an arrow icon.
Background: linear-gradient(135deg, #ec4899, #8b5cf6)
Text: #ffffff
Padding: 16px 40px
Border-radius: 999px
Shadow: 0 6px 20px rgba(139,92,246,0.35)
Icon: arrow-right
.btn {
background: linear-gradient(
135deg, #ec4899, #8b5cf6);
color: #fff;
padding: 16px 40px;
border-radius: 999px;
box-shadow: 0 6px 20px
rgba(139,92,246,0.35);
border: none;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 8px;
}
Who Uses This
Prototyping button styles before committing them to a design system or component library.
Handing off pixel-perfect button CSS to developers instead of screenshots and spec documents.
Learning how CSS properties like box-shadow, gradient, and border-radius actually affect a button visually.
Shipping landing pages fast without hiring a designer — pick a look, grab the code, move on.
Common Mistakes
Browsers add a default border to <button> elements. If you set a background color but don't add border: none, you get a thin gray outline that clashes with your design. Always explicitly set the border property.
Subtle color shifts are hard to notice, especially on small screens. Pair a color change with a slight transform: translateY(-1px) or shadow increase so users actually feel the interaction.
A button that looks fine on desktop can be nearly impossible to tap on mobile. Keep the minimum touch target at 44×44 pixels. If your button text is short, bump the padding instead of shrinking the hit area.
Technical Details
- Processing: 100% client-side — your design choices never leave the browser
- Browser Support: Chrome, Firefox, Safari, Edge (all modern versions)
- CSS Output: Standard CSS3 — no preprocessor or framework needed
- Gradient Support: Linear gradients with configurable angle and color stops
- Icon Library: Built-in SVG icons included in the HTML output
Frequently Asked Questions
How do I make a button with CSS only?
Set the background color, text color, padding, and border-radius on a <button> or <a> tag. Add border: none and cursor: pointer so it looks and acts clickable. A hover state with a slightly darker background finishes the job. That is genuinely all you need for a basic CSS-only button.
What is the best border-radius for a button?
There is no single correct value — it depends on your design language. A 4-8px radius gives a modern, slightly rounded look that works on most sites. For a pill shape, set border-radius to 999px or 50%. Fully square corners (0px) look more industrial or brutalist.
How do I add a gradient to a CSS button?
Replace the solid background-color with background: linear-gradient(direction, color1, color2). For example, background: linear-gradient(135deg, #ec4899, #8b5cf6) creates a pink-to-purple diagonal gradient. This generator handles it automatically — just toggle the gradient option and pick your colors.
Can I use the generated CSS in React or Vue?
Yes. The output is plain CSS, so it works anywhere — React, Vue, Svelte, plain HTML, WordPress themes, whatever. Paste it into your stylesheet or convert the properties to inline styles or a CSS-in-JS object if that's your setup.
Why does my button look different in Safari?
Safari applies its own default styling to <button> elements, including a special appearance property. Add -webkit-appearance: none and explicitly set your font, padding, and background to override those defaults. The CSS from this generator already produces cross-browser-safe output, so this is mostly an issue if you're writing it by hand.