SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/gradient-buttons

7 CSS Gradient Buttons

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

Seven gradient buttons that stay readable: a sweeping sunset fill, a rounded gradient outline, a mesh of radial gradients, a shine streak, a gradient-text secondary button, a gradient that drifts slowly, and a primary and secondary pair that shows where a gradient belongs.

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; }

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.