Open demo

CSS code

HTML
<button type="button" class="gb gb-indigo">Get started</button>
<button type="button" class="gb gb-sunset">Join the beta</button>
<button type="button" class="gb gb-ocean">Download free</button>
<button type="button" class="gb gb-slate">View pricing</button>
<button type="button" class="gb gb-ring">Gradient border</button>
<button type="button" class="gb gb-flow">Animated flow</button>
CSS
/* Gradient buttons: a gradient background-image on a real <button>. Hover lifts 2px and adds a shadow tinted with --gb-glow. */
.gb{--gb-glow:rgba(79,70,229,.55);display:inline-block;border:0;border-radius:12px;padding:14px 30px;
  font:inherit;font-size:.92rem;font-weight:700;line-height:1.25;color:#fff;cursor:pointer;
  background-color:#4f46e5;background-size:150% 150%;transition:transform .15s,box-shadow .15s}
.gb:hover{transform:translateY(-2px);box-shadow:0 14px 28px -10px var(--gb-glow)}
.gb:active{transform:translateY(0)}
.gb:focus-visible{outline:2px solid #4f46e5;outline-offset:3px}
.gb-indigo{background-image:linear-gradient(120deg,#4f46e5,#9333ea);--gb-glow:rgba(124,58,237,.55)}
.gb-sunset{background-color:#e11d48;background-image:linear-gradient(120deg,#e11d48,#c2410c);--gb-glow:rgba(225,29,72,.55)}
.gb-ocean{background-color:#0e7490;background-image:linear-gradient(120deg,#0e7490,#047857);--gb-glow:rgba(4,120,87,.55)}
.gb-slate{background-color:#0f172a;background-image:linear-gradient(120deg,#0f172a,#334155);--gb-glow:rgba(15,23,42,.55)}
/* gradient border: a white padding-box layer over a gradient border-box layer */
.gb-ring{color:#7c3aed;border:2.5px solid transparent;border-radius:14px;--gb-glow:rgba(236,72,153,.4);
  background:linear-gradient(#fff,#fff) padding-box,linear-gradient(120deg,#6366f1,#ec4899,#ea580c) border-box}
/* animated flow: a 300% wide gradient that slides forever */
.gb-flow{background-image:linear-gradient(270deg,#4f46e5,#db2777,#b45309,#4f46e5);background-size:300% 100%;
  animation:gb-flow 4s linear infinite;--gb-glow:rgba(219,39,119,.5)}
@keyframes gb-flow{to{background-position:300% 0}}
@media (prefers-reduced-motion:reduce){.gb{transition:none}.gb:hover{transform:none}.gb-flow{animation:none}}

Bootstrap 5 code

Requires: Bootstrap 5.3.8 CSS

HTML
<button type="button" class="btn btn-gb btn-gb-indigo">Get started</button>
<button type="button" class="btn btn-gb btn-gb-sunset">Join the beta</button>
<button type="button" class="btn btn-gb btn-gb-ocean">Download free</button>
<button type="button" class="btn btn-gb btn-gb-slate">View pricing</button>
<button type="button" class="btn btn-gb btn-gb-ring">Gradient border</button>
<button type="button" class="btn btn-gb btn-gb-flow">Animated flow</button>
CSS
/* Bootstrap .btn sized and coloured through --bs-btn-* variables; the gradient is a background-image on top. */
.btn-gb{--bs-btn-padding-x:30px;--bs-btn-padding-y:14px;--bs-btn-font-size:.92rem;--bs-btn-font-weight:700;--bs-btn-line-height:1.25;
  --bs-btn-border-width:0;--bs-btn-border-radius:12px;--bs-btn-focus-box-shadow:none;
  --bs-btn-color:#fff;--bs-btn-hover-color:#fff;--bs-btn-active-color:#fff;
  --bs-btn-bg:var(--gb-from);--bs-btn-hover-bg:var(--gb-from);--bs-btn-active-bg:var(--gb-from);
  --gb-from:#4f46e5;--gb-glow:rgba(79,70,229,.55);
  background-size:150% 150%;transition:transform .15s,box-shadow .15s}
.btn-gb:hover{transform:translateY(-2px);box-shadow:0 14px 28px -10px var(--gb-glow)}
.btn-gb:active{transform:translateY(0)}
.btn-gb:focus-visible{outline:2px solid #4f46e5;outline-offset:3px}
.btn-gb-indigo{background-image:linear-gradient(120deg,#4f46e5,#9333ea);--gb-glow:rgba(124,58,237,.55)}
.btn-gb-sunset{background-image:linear-gradient(120deg,#e11d48,#c2410c);--gb-from:#e11d48;--gb-glow:rgba(225,29,72,.55)}
.btn-gb-ocean{background-image:linear-gradient(120deg,#0e7490,#047857);--gb-from:#0e7490;--gb-glow:rgba(4,120,87,.55)}
.btn-gb-slate{background-image:linear-gradient(120deg,#0f172a,#334155);--gb-from:#0f172a;--gb-glow:rgba(15,23,42,.55)}
.btn-gb-ring{--bs-btn-color:#7c3aed;--bs-btn-hover-color:#7c3aed;--bs-btn-active-color:#7c3aed;--gb-from:transparent;
  --bs-btn-border-width:2.5px;--bs-btn-border-color:transparent;--bs-btn-hover-border-color:transparent;--bs-btn-active-border-color:transparent;
  --bs-btn-border-radius:14px;--gb-glow:rgba(236,72,153,.4);
  background-image:linear-gradient(#fff,#fff),linear-gradient(120deg,#6366f1,#ec4899,#ea580c);
  background-origin:border-box;background-clip:padding-box,border-box;background-size:auto}
.btn-gb-flow{background-image:linear-gradient(270deg,#4f46e5,#db2777,#b45309,#4f46e5);background-size:300% 100%;
  animation:gb-flow 4s linear infinite;--gb-glow:rgba(219,39,119,.5)}
@keyframes gb-flow{to{background-position:300% 0}}
@media (prefers-reduced-motion:reduce){.btn-gb{transition:none}.btn-gb:hover{transform:none}.btn-gb-flow{animation:none}}

Tailwind 4 code

Requires: Tailwind CSS 4

HTML
<button type="button" class="cursor-pointer rounded-xl bg-[#4f46e5] bg-[linear-gradient(120deg,#4f46e5,#9333ea)] bg-[length:150%_150%] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-white transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(124,58,237,.55)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:transition-none motion-reduce:hover:translate-y-0">Get started</button>
<button type="button" class="cursor-pointer rounded-xl bg-[#e11d48] bg-[linear-gradient(120deg,#e11d48,#c2410c)] bg-[length:150%_150%] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-white transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(225,29,72,.55)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:transition-none motion-reduce:hover:translate-y-0">Join the beta</button>
<button type="button" class="cursor-pointer rounded-xl bg-[#0e7490] bg-[linear-gradient(120deg,#0e7490,#047857)] bg-[length:150%_150%] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-white transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(4,120,87,.55)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:transition-none motion-reduce:hover:translate-y-0">Download free</button>
<button type="button" class="cursor-pointer rounded-xl bg-[#0f172a] bg-[linear-gradient(120deg,#0f172a,#334155)] bg-[length:150%_150%] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-white transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(15,23,42,.55)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:transition-none motion-reduce:hover:translate-y-0">View pricing</button>
<button type="button" class="cursor-pointer rounded-[14px] border-[2.5px] border-transparent [background:linear-gradient(#fff,#fff)_padding-box,linear-gradient(120deg,#6366f1,#ec4899,#ea580c)_border-box] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-[#7c3aed] transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(236,72,153,.4)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:transition-none motion-reduce:hover:translate-y-0">Gradient border</button>
<button type="button" class="animate-gb-flow cursor-pointer rounded-xl bg-[#4f46e5] bg-[linear-gradient(270deg,#4f46e5,#db2777,#b45309,#4f46e5)] bg-[length:300%_100%] px-[30px] py-3.5 text-[.92rem] leading-[1.25] font-bold text-white transition-[translate,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-[0_14px_28px_-10px_rgba(219,39,119,.5)] active:translate-y-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-[#4f46e5] motion-reduce:animate-none motion-reduce:transition-none motion-reduce:hover:translate-y-0">Animated flow</button>
CSS
@theme {
  --animate-gb-flow: gb-flow 4s linear infinite;
  @keyframes gb-flow { to { background-position: 300% 0; } }
}

About this set

Six call-to-action buttons built on CSS gradients. Four are solid two-colour fills: indigo to purple, rose to burnt orange, teal to emerald and a dark slate, each with a coloured shadow that appears when the button lifts 2 pixels on hover. The fifth has a gradient border around a white face, drawn with two background layers, a white one clipped to the padding box over a gradient clipped to the border box, so it needs no extra element and survives any parent background. The sixth, Animated flow, slides a 300 percent wide gradient across the button in a four second loop. Use the solid fills for primary actions, the bordered one as a secondary action next to them, and the animated one sparingly, for a single launch or promo button. All six are plain button elements with type=”button”, so they work with a keyboard and in forms without any script. Gradient stops were darkened where needed so the white labels reach 4.5:1 across the whole gradient. The Bootstrap version sets the size and colours through –bs-btn-* variables on .btn, and the Tailwind version uses arbitrary gradient values.

What’s included

  • Four two-colour gradient fills with a tinted hover shadow
  • Gradient border made from two background layers, no pseudo-element
  • Animated flow gradient that stops under reduced motion
  • White labels at 4.5:1 or better across every gradient
  • Plain CSS, Bootstrap .btn and Tailwind versions of the same design

Accessibility

Every control is a native button with visible text, so it is announced by name and works with Tab, Enter and Space. Keyboard focus draws a 2px indigo outline 3px outside the button. Under prefers-reduced-motion the hover lift, its transition and the flowing gradient are all switched off.

Customise it

In plain CSS change the linear-gradient stops on .gb-indigo, .gb-sunset and the other modifiers, and --gb-glow for the hover shadow. In Bootstrap edit the same gradients on the .btn-gb-* classes and --bs-btn-padding-x/-y for size; in Tailwind edit the bg-[linear-gradient(...)] and hover:shadow-[...] utilities.