Free ToolsGuidesCase StudiesResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/gradient-buttons

12 CSS Gradient Buttons

12 Pure CSSPublished 2026-10-05Free · no sign-up

Twelve gradient buttons that stay readable. To use one, pick a design, press Copy or Open in editor, paste the HTML where the button goes and the CSS into your stylesheet, then swap the colours for your brand. The set covers a sweeping sunset fill, a rounded gradient outline, a mesh of radial gradients, a shine streak, gradient text, a slowly drifting gradient, a primary and secondary pair, a spinning conic border, an arrow pill, a soft glow, a pressable 3D key and a hard-stop split.

01. Sunset Gradient Button

GradientPrimary

A warm gradient with white text. Every stop is dark enough for the label to keep at least 4.5:1 contrast, and hover shifts background-position across a gradient twice the width of the button, which animates smoothly where a gradient change would not.

View code
<button class="gb1">Start free trial</button>
.gb1 { padding: 15px 28px; border: 0; border-radius: 12px; background: linear-gradient(90deg, #c2410c, #be123c 50%, #c2410c) 0 0 / 200% 100%; color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; transition: background-position .5s ease, transform .2s; }
.gb1:hover, .gb1:focus-visible { background-position: 100% 0; }
.gb1:active { transform: translateY(1px); }
.gb1:focus-visible { outline: 3px solid #fb923c; outline-offset: 3px; }

02. Gradient Outline Button

GradientOutline

A rounded gradient border made with two backgrounds: the padding-box layer is the button colour and the border-box layer is the gradient, seen through a transparent border. On hover the inner layer turns to the gradient too, filling the button.

View code
<button class="gb2">Book a demo</button>
.gb2 { padding: 14px 26px; border: 2px solid transparent; border-radius: 999px; background: linear-gradient(#0e1118, #0e1118) padding-box, linear-gradient(90deg, #8b5cf6, #ec4899) border-box; color: #f5f3ff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; }
.gb2:hover, .gb2:focus-visible { background: linear-gradient(90deg, #7c3aed, #db2777) padding-box, linear-gradient(90deg, #8b5cf6, #ec4899) border-box; }
.gb2:focus-visible { outline: 2px solid #f9a8d4; outline-offset: 4px; }

03. Mesh Gradient Button

GradientMesh

Three radial gradients layered over a base colour make a soft mesh, the blurred-colour look of many product sites, with no image file. An inset white highlight along the top edge and a coloured shadow underneath give the surface depth.

View code
<button class="gb3">Download the app</button>
.gb3 { padding: 16px 30px; border: 0; border-radius: 16px; background: radial-gradient(circle at 15% 20%, #0891b2 0, transparent 45%), radial-gradient(circle at 85% 30%, #9333ea 0, transparent 50%), radial-gradient(circle at 50% 110%, #2563eb 0, transparent 60%), #1e1b4b; color: #fff; font: 800 16px Inter, system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 30px -10px #7c3aed; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.gb3:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 16px 34px -10px #7c3aed; }
.gb3:focus-visible { outline: 3px solid #67e8f9; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .gb3 { transition: none; } .gb3:hover { transform: none; } }

04. Gradient Button with Shine Sweep

GradientHover

A green gradient button with a diagonal white streak that crosses it on hover. The streak is a skewed pseudo-element moved by its left position inside overflow: hidden, so it stays within the rounded corners, and it is removed for reduced motion.

View code
<button class="gb4">Place order</button>
.gb4 { position: relative; overflow: hidden; padding: 15px 30px; border: 0; border-radius: 10px; background: linear-gradient(135deg, #047857, #0f766e); color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; }
.gb4::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); transition: left .6s ease; }
.gb4:hover::after, .gb4:focus-visible::after { left: 120%; }
.gb4:focus-visible { outline: 3px solid #34d399; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .gb4::after { display: none; } }

05. Gradient Text Button

GradientGhost

A quiet secondary button whose label is filled with a gradient using background-clip: text on an inner span. A pale tinted background and a matching border keep it readable as a button, and both gradient stops are dark enough to pass contrast on the tint.

View code
<button class="gb5"><span>Compare plans &rarr;</span></button>
.gb5 { padding: 13px 24px; border: 1px solid #c7d2fe; border-radius: 10px; background: #eef2ff; color: #4338ca; font: 800 16px Inter, system-ui, sans-serif; cursor: pointer; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .gb5 span { background: linear-gradient(90deg, #4338ca, #9d174d); -webkit-background-clip: text; background-clip: text; color: transparent; }
}
.gb5:hover { border-color: #a5b4fc; background: #e0e7ff; }
.gb5:focus-visible { outline: 2px solid #4338ca; outline-offset: 3px; }

06. Slowly Shifting Gradient

GradientAnimation

A four-colour gradient three times the size of the button drifts back and forth over eight seconds, so the button feels alive without flashing. The animation only moves background-position, and it stops completely when reduced motion is requested.

View code
<button class="gb6">Generate palette</button>
.gb6 { padding: 15px 28px; border: 0; border-radius: 14px; background: linear-gradient(120deg, #1d4ed8, #7e22ce, #be185d, #1d4ed8) 0 50% / 300% 300%; color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; animation: gb6 8s ease-in-out infinite alternate; }
@keyframes gb6 { to { background-position: 100% 50%; } }
.gb6:focus-visible { outline: 3px solid #f0abfc; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .gb6 { animation: none; } }

07. Gradient Primary with Plain Secondary

GradientLayout

A pair of actions where only the primary one gets the gradient, which is how gradients work best: as emphasis, not decoration everywhere. Both buttons share a height and radius, and they wrap onto two lines on narrow screens.

View code
<div class="gb7"><button class="p">Create account</button><button class="s">Sign in</button></div>
.gb7 { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; box-sizing: border-box; max-width: 100%; }
.gb7 button { min-height: 48px; padding: 0 24px; border-radius: 12px; font: 700 15px Inter, system-ui, sans-serif; cursor: pointer; }
.gb7 .p { border: 0; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; box-shadow: 0 8px 20px -8px #4f46e5; }
.gb7 .s { border: 1px solid #d0d5dd; background: #fff; color: #1d2939; }
.gb7 button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

08. Spinning Conic Gradient Border

GradientBorderHover

A conic gradient sits behind a dark inner label and shows only as a 3px frame. On hover the gradient rotates, so the colours travel around the border. The spinning layer is a square pseudo-element larger than the button's diagonal, which keeps the corners covered at every angle, and it holds still for reduced motion.

View code
<button class="gb8"><span>Get started</span></button>
.gb8 { position: relative; isolation: isolate; overflow: hidden; box-sizing: border-box; max-width: 100%; padding: 3px; border: 0; border-radius: 14px; background: #312e81; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; }
.gb8::before { content: ""; position: absolute; left: 50%; top: 50%; z-index: -1; width: 160%; aspect-ratio: 1; translate: -50% -50%; background: conic-gradient(#2563eb, #9333ea, #db2777, #ea580c, #2563eb); animation: gb8 3s linear infinite paused; }
.gb8 span { display: block; padding: 13px 26px; border-radius: 11px; background: #0b0f19; color: #f8fafc; transition: background .25s; }
.gb8:hover::before, .gb8:focus-visible::before { animation-play-state: running; }
.gb8:hover span, .gb8:focus-visible span { background: #151a2c; }
.gb8:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 4px; }
@keyframes gb8 { to { rotate: 1turn; } }
@media (prefers-reduced-motion: reduce) { .gb8::before { animation: none; } }

09. Gradient Pill with Sliding Arrow

GradientIconHover

A teal-to-blue pill with an arrow in a translucent circle that nudges forward on hover, a small cue that the button moves you on. The arrow is decorative and hidden from screen readers, so the accessible name stays just the label.

View code
<button class="gb9">See pricing <span aria-hidden="true">→</span></button>
.gb9 { display: inline-flex; align-items: center; gap: 10px; box-sizing: border-box; max-width: 100%; padding: 10px 12px 10px 26px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #0f766e, #1d4ed8); color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; }
.gb9 span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .18); transition: transform .25s ease; }
.gb9:hover span, .gb9:focus-visible span { transform: translateX(4px); }
.gb9:focus-visible { outline: 3px solid #5eead4; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .gb9 span { transition: none; } }

10. Gradient Button with Soft Glow

GradientGlow

The glow is a blurred copy of the button's own gradient: a pseudo-element inherits the background, sits behind the button and is softened with filter: blur. Hover brightens the glow instead of the button, so the label contrast never changes.

View code
<button class="gb10">Join the beta</button>
.gb10 { position: relative; isolation: isolate; box-sizing: border-box; max-width: 100%; padding: 15px 30px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #6d28d9, #be185d); color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; }
.gb10::before { content: ""; position: absolute; inset: 8px 12px -8px; z-index: -1; border-radius: inherit; background: inherit; filter: blur(18px); opacity: .5; transition: opacity .3s; }
.gb10:hover::before, .gb10:focus-visible::before { opacity: .95; }
.gb10:focus-visible { outline: 3px solid #f0abfc; outline-offset: 3px; }

11. Pressable 3D Gradient Button

Gradient3DActive

A top-to-bottom blue gradient on a solid darker ledge made with a hard box-shadow. Pressing it moves the button down by the ledge height and shrinks the shadow, so it feels like a physical key. Only transform and box-shadow change, which keeps the press smooth.

View code
<button class="gb11">Add to cart</button>
.gb11 { box-sizing: border-box; max-width: 100%; padding: 14px 28px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #2563eb, #1d4ed8); color: #fff; font: 700 16px Inter, system-ui, sans-serif; box-shadow: 0 5px 0 #1e3a8a, 0 9px 18px rgba(30, 58, 138, .35); cursor: pointer; transition: transform .1s, box-shadow .1s; }
.gb11:hover { background: linear-gradient(180deg, #2563eb, #1e40af); }
.gb11:active { transform: translateY(4px); box-shadow: 0 1px 0 #1e3a8a, 0 3px 8px rgba(30, 58, 138, .3); }
.gb11:focus-visible { outline: 3px solid #93c5fd; outline-offset: 4px; }

12. Hard-Stop Split Gradient Button

GradientHover

Two colour stops at the same position make a crisp diagonal split instead of a blend. The gradient is twice the button's width, so moving background-position on hover slides the split across the label. Both colours are dark enough for white text.

View code
<button class="gb12">Compare plans</button>
.gb12 { box-sizing: border-box; max-width: 100%; padding: 15px 30px; border: 0; border-radius: 10px; background: linear-gradient(115deg, #b91c1c 50%, #7e22ce 50%) 30% 0 / 200% 100%; color: #fff; font: 700 16px Inter, system-ui, sans-serif; cursor: pointer; transition: background-position .45s ease; }
.gb12:hover, .gb12:focus-visible { background-position: 70% 0; }
.gb12:focus-visible { outline: 3px solid #fca5a5; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .gb12 { transition: none; } }

About these CSS Gradient Buttons

Check the contrast at every stop

A gradient is only as readable as its lightest point under the text. Test the white label against each colour stop, not just the middle, and darken any stop that falls under 4.5:1.

Animate position, not colours

Browsers cannot transition one gradient into another, but they can move it. Make the background larger than the button with background-size and transition background-position for a smooth shift.

Gradient borders with two backgrounds

A rounded gradient border needs no extra element: give the button a transparent border and two backgrounds, a solid one clipped to padding-box and the gradient clipped to border-box.

Use gradients for emphasis

When every button has a gradient, none stands out. Keep the gradient for the main action and give secondary actions a plain or outlined style.

Frequently asked questions

Can I use these on a light and a dark site?

Yes. Each demo shows its intended background, and the colours are easy to swap in the CSS.

Why is the gradient text inside a span?

background-clip: text clips the whole background, so the gradient sits on the label span and the button keeps its own solid tint.

Do gradients slow the page down?

No. Gradients are drawn by the browser with no image download, and the animated ones only move background-position.