Skip to content

Gradient Buttons

Pure CSS gradient buttons with shifting colors on hover, a gradient outline, glow and shine effects, sizes and a disabled state.

Also known as: gradient button hover, animated gradient buttons, glowing gradient button, outline gradient button

Gradient Buttons live demo

Open in new tab

Pure CSS code (HTML, CSS)

A collection of gradient buttons in pure CSS with animated hover effects: shifting gradients, a gradient outline that fills in, a soft glow and a light sweep. It works for hero calls to action, sign-up forms, pricing cards and landing pages on dark backgrounds. No JavaScript is used.

How it works

The demo wrapper section.gb-showcase holds three .gb-group blocks, each with a .gb-label and a flex .gb-row that wraps on small screens. Every button uses the base class .gb-btn, which works on both button and a elements. The base builds --gb-grad from three stops, --gb-from, --gb-via and --gb-to, and paints it at background-size: 300% 100%. On :hover and :focus-visible the background-position moves from 0% to 100%, so the colors slide across the button while it lifts by 2px and the shadow grows.

Palette modifiers (.gb-btn--sunset, .gb-btn--ocean, .gb-btn--aurora, .gb-btn--mango) only change the three color stops and --gb-ink. Effect modifiers stack on top of them:

  • .gb-btn--outline draws the gradient in the border box and a solid --gb-surface in the padding box. --gb-surface is registered with @property, so the inner fill fades to a lighter shade on hover.
  • .gb-btn--glow adds a blurred copy of the gradient in ::before that grows on hover.
  • .gb-btn--shine moves a skewed white streak in ::after across the button.
  • .gb-icon slides 4px to the right when its button is hovered.

Customization

  • --gb-from, --gb-via and --gb-to on any .gb-btn (or a new palette class): the gradient colors.
  • --gb-ink in a palette class: the label color; .gb-btn--mango uses a dark ink for contrast on yellow.
  • --gb-radius on .gb-showcase: corner radius of every button; add .gb-btn--pill for fully rounded ends.
  • --gb-angle on .gb-showcase: the gradient direction, 120deg by default.
  • .gb-btn--sm and .gb-btn--lg: smaller or larger height, padding and font size.
  • Combine modifiers, such as gb-btn gb-btn--lg gb-btn--glow gb-btn--sunset, to mix size, effect and palette.
  • --gb-bg on .gb-showcase: the page background, which is also the inner fill of outline buttons.

Use cases

  • Hero sections: a bold gradient call-to-action button draws attention on dark landing pages
  • Sign-up forms: submit buttons shift colors on hover and show a clear disabled state
  • Pricing cards: gradient outline buttons keep secondary plans visible without competing with the main one
  • Marketing campaigns: palette, glow and shine variants in three sizes match different promotions

Accessibility

Real button and a elements keep native keyboard behavior, and every hover effect also runs on :focus-visible together with a white --gb-focus outline. Label colors are chosen for readable contrast on their gradients. The decorative arrow is aria-hidden. Disabled buttons use the native disabled attribute (or aria-disabled="true" on links) and lose their hover motion. With prefers-reduced-motion: reduce all transitions, lifts and the shine sweep are switched off.

Usage notes

Copy the .gb-btn rules plus the modifiers you need; .gb-showcase, .gb-group and .gb-row are only demo layout. If you drop .gb-showcase, move its custom properties to :root.

Gradient Buttons at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile, dark design
Category
Button Styles
License
Free for personal and commercial use

Questions about this template

Can I use the Gradient Buttons code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Gradient Buttons – free Pure CSS button style template
Gradient Buttons · free Pure CSS button style template

More Button Styles

3D Pushable Buttons – free Tailwind CSS button style template

3D Pushable Buttons

Tailwind CSS 3D buttons with a raised edge that lift on hover and press down on click, with sizes, icon buttons and toggles.

Animated Hover Buttons – free Pure CSS button style template

Animated Hover Buttons

Eight pure CSS hover buttons with fill, diagonal, sliding text, border drawing, arrow, underline and press effects that also run on focus.

Buttons with Loading State – free Bootstrap 5 button style template

Buttons with Loading State

Bootstrap 5 buttons that show a spinner, block repeat clicks while working and then display a success or error state, in solid, outline, pill and icon styles.

Button Variants – free Tailwind CSS button style template

Button Variants

Tailwind CSS button set with primary, secondary, outline, ghost, danger and link variants, five sizes, icon buttons, loading and disabled states.