Skip to content

CSS Button Generator

Design and generate custom CSS button styles with live preview and instant code export.

Updated

What is the CSS Button Generator?

How it works

Examples

Primary Call-to-Action Button

Background: #2563eb, Text: #ffffff, Padding: 10px 20px, Border radius: 6px, Hover background: #1d4ed8, Transition: 150ms ease-in-out
.btn { display: inline-flex; align-items: center; padding: 10px 20px; font-size: 14px; font-weight: 500; color: #ffffff; background: #2563eb; border: none; border-radius: 6px; cursor: pointer; transition: background, color, box-shadow 150ms ease-in-out; } .btn:hover { background: #1d4ed8; }

Ghost / Outline Button

Background: transparent, Text: #2563eb, Border: 1px solid #2563eb, Hover background: #eff6ff, Hover text: #1d4ed8
.btn-ghost { display: inline-flex; align-items: center; padding: 10px 20px; color: #2563eb; background: transparent; border: 1px solid #2563eb; border-radius: 6px; cursor: pointer; transition: background, color, border-color 150ms ease-in-out; } .btn-ghost:hover { background: #eff6ff; color: #1d4ed8; border-color: #1d4ed8; }

Gradient Button with Glow Shadow

Gradient: #2563eb to #9333ea at 135deg, Shadow: 0 4px 20px rgba(79,70,229,0.45), Border: none, Border radius: 6px
.btn-gradient { display: inline-flex; align-items: center; padding: 10px 20px; color: #ffffff; background: linear-gradient(135deg, #2563eb, #9333ea); border: none; border-radius: 6px; box-shadow: 0 4px 20px rgba(79, 70, 229, 0.45); cursor: pointer; transition: background, box-shadow 150ms ease-in-out; } .btn-gradient:hover { background: linear-gradient(135deg, #1d4ed8, #7e22ce); }

Pill Button with Spring Animation

Border radius: 9999px, Padding: 10px 28px, Active scale: 0.93, Easing: cubic-bezier(0.34,1.56,0.64,1), Duration: 300ms
.btn-pill { display: inline-flex; align-items: center; padding: 10px 28px; border-radius: 9999px; transition: background, transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1); } .btn-pill:active { transform: scale(0.93); }

Frequently asked questions