CSS Gradient Generator

Create beautiful linear and radial CSS gradients with a live visual editor and instant code output.

Settings

135 deg

CSS Code

How to Use

1

Select gradient type

Choose linear (directional color flow) or radial (center-outward color radiation).

2

Choose colors and stops

Pick start and end colors. Add intermediate stops for multi-color gradients.

3

Adjust angle or position

Set the angle for linear gradients or the center position for radial gradients.

4

Copy the CSS code

Copy the generated background CSS property and use it directly in your stylesheet.

What is a CSS Gradient?

CSS gradients let you create smooth transitions between two or more colors without using images. They render at any resolution, scale perfectly on retina displays, and reduce page weight compared to image-based backgrounds. Browser support is universal in all modern browsers.

Real-World Examples & Use Cases

Hero Section Backgrounds

Gradient backgrounds on hero sections create visual depth without requiring image downloads. A subtle top-to-bottom gradient from #1e3a8a to #3b82f6 produces a professional blue sky effect. Overlaying text on a gradient avoids the contrast inconsistencies of photographic backgrounds. Many modern SaaS landing pages use gradients exclusively for hero backgrounds to achieve consistent branding, fast load times, and perfect rendering at every screen size and resolution.

Button and CTA Styling

Gradient fills on call-to-action buttons create a sense of depth and visual interest that solid colors lack. A left-to-right gradient from #6366f1 (indigo) to #8b5cf6 (violet) on a primary CTA button follows modern glassmorphism and material design patterns. The gradient draws the eye toward the button and suggests interactivity. Verifying that text maintains WCAG 4.5:1 contrast ratio against the lightest part of the gradient ensures accessibility compliance.

Card Decorative Accents

Thin gradient lines (2-4px height, 100% width) used as top borders on cards or section dividers add color identity without overwhelming content. Setting border-top: 3px solid transparent; border-image: linear-gradient(to right, #3b82f6, #8b5cf6) 1; creates a multi-color decorative border. Feature cards in documentation sites and SaaS product pages frequently use gradient accents to visually categorize or highlight specific feature sections.

Text Gradient Effects

CSS gradients applied to text using background-clip: text create eye-catching typographic effects for headings and logo text. The technique requires: background: linear-gradient(...); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; color: transparent. Gradient text is a prominent trend in Web3, AI product branding, and design-forward marketing sites where visual differentiation of key headings drives brand recall.

How It Works

CSS gradient syntax: Linear gradient: background: linear-gradient(angle, color1 stop1, color2 stop2, ...); Examples: background: linear-gradient(90deg, #3b82f6, #8b5cf6); background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #7c3aed 100%); Radial gradient: background: radial-gradient(shape size at position, color1, color2); Example: background: radial-gradient(circle at center, #3b82f6 0%, #1e3a8a 100%); Angle reference: 0deg = bottom → top 90deg = left → right 180deg = top → bottom 270deg = right → left Color stops: percentages (0%–100%) or length values (px, em) along the gradient line

Frequently Asked Questions

What is the difference between linear and radial gradients?
A linear gradient transitions colors along a straight line at a set angle — left to right, top to bottom, or diagonally. A radial gradient radiates colors outward from a center point in a circular or elliptical shape. Linear gradients are used more commonly for backgrounds and overlays; radial gradients create spotlight, vignette, and center-glow effects.
Can I use more than two colors in a CSS gradient?
Yes — you can add as many color stops as needed. Each stop specifies a color and its position along the gradient axis: linear-gradient(90deg, #red 0%, #yellow 33%, #green 66%, #blue 100%). Three, four, or five-color gradients create rainbow or sunset effects. Adding a hard stop (two consecutive stops at the same position) creates a sharp color transition instead of a gradual blend.
How do I make a gradient transparent?
Use rgba() or the transparent keyword for color stops: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent). This is commonly used for image overlay scrim effects — darkening the top or bottom of a photograph to ensure text remains legible without obscuring the full image. The transparent keyword equals rgba(0,0,0,0) in CSS.
Are CSS gradients supported in all browsers?
Yes. CSS gradients (both linear and radial) are supported in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. They have been universally supported since ~2012. You no longer need -webkit- vendor prefixes for basic gradient syntax in production code. Only very old browsers (IE9 and below) lack support, which are statistically negligible in modern web analytics.
Can I animate a CSS gradient?
Direct animation of gradient color stops is not supported by CSS transitions/animations (gradients are treated as images, not interpolatable values). The workaround is to animate the background-position of a larger gradient background: set background-size: 300% 300% and animate background-position from 0% 50% to 100% 50%. This creates a flowing color shift effect. Alternatively, CSS custom property (@property) animations in modern browsers support animating gradient stops via registered color properties.

Related Tools

Explore other tools in this category.

Looking for something else?