What you'll learn
- 8 named linear gradients with vivid colour stories
- 4 radial gradient techniques for focal depth
- 3 conic gradient examples including pie charts and color wheels
- Diagonal gradients for dynamic layouts
- Mesh / multi-stop gradients that mimic Figma's mesh fill
- Animated gradients using @keyframes
- Accessibility tips for using gradients behind text
CSS Gradient Quick Reference
CSS provides three native gradient functions. All are values for the background or background-image property - they are images, not colors.
/* Linear - straight direction */ background: linear-gradient(direction, color-stop1, color-stop2, ...); /* Radial - outward from a center point */ background: radial-gradient(shape size at position, color-stop1, color-stop2, ...); /* Conic - rotates around a center point */ background: conic-gradient(from angle at position, color-stop1, color-stop2, ...); /* Multiple gradients - comma-separated, first is topmost */ background: radial-gradient(...), linear-gradient(...);
Linear Gradients
Linear gradients travel in a straight line between two or more color stops. The direction can be specified as a keyword (to right,to bottom right) or as an angle in degrees.
Ocean Breeze
Cool blue-violet diagonal - a perennial favourite for hero sections.
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
Sunset Horizon
Warm pink-to-coral - excellent for lifestyle and beauty brands.
background: linear-gradient(to right, #f093fb 0%, #f5576c 100%);
Emerald Forest
Fresh teal-to-mint - great for wellness, finance, and eco products.
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
Midnight Blue
Deep navy multi-stop - ideal for dark-mode hero sections and app backgrounds.
background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
Golden Hour
Warm amber-to-gold - high energy for CTAs, pricing cards, and promotions.
background: linear-gradient(to right, #f7971e 0%, #ffd200 100%);
Cotton Candy
Soft pastel peach - gentle and approachable for onboarding and empty states.
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
Electric Violet
Bold purple-to-pink - the signature gradient of the web 3.0 aesthetic.
background: linear-gradient(to bottom right, #7928ca 0%, #ff0080 100%);
Arctic Dawn
Sky-blue to teal - clean and corporate, excellent for SaaS dashboards.
background: linear-gradient(160deg, #0093E9 0%, #80D0C7 100%);
Radial Gradients
Radial gradients emit from a single point outward in an ellipse or circle. Shifting the center with at X% Y% creates off-center focal points that add drama and depth.
Solar Flare
Off-center radial burst - creates a dramatic focal point.
background: radial-gradient(circle at 30% 30%, #ffeaa7 0%, #fd79a8 50%, #6c5ce7 100%);
Deep Space
Dark elliptical glow - perfect for space, gaming, and tech themes.
background: radial-gradient(ellipse at center, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
Spotlight
Transparent radial from top - overlay on dark backgrounds for a spotlight effect.
background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.4) 0%, transparent 70%);
Sunrise Glow
Radial rising from bottom - simulates warm morning light on a page.
background: radial-gradient(circle at 50% 100%, #ff9a9e 0%, #fecfef 40%, #ffecd2 80%, transparent 100%);
Conic Gradients
Conic gradients rotate color stops around a central point - like the hands of a clock sweeping through hues. They're perfect for pie charts, color pickers, and angular abstract backgrounds.
Color Wheel
Full spectrum conic - used for color pickers, creative portfolio backgrounds.
background: conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
Pie Chart
Hard-stop conic - useful for pie chart visualizations without SVG.
background: conic-gradient(#6366f1 0% 30%, #ec4899 30% 60%, #f59e0b 60% 80%, #10b981 80% 100%);
Angular Sweep
Two-tone angular sweep - gives surfaces an energetic rotational feel.
background: conic-gradient(from 180deg at 50% 50%, #2563eb 0deg, #7c3aed 180deg, #2563eb 360deg);
Diagonal Gradients
Diagonal gradients (45° and 135°) inject energy and movement into static layouts. They're the go-to for hero sections that need dynamism without photography.
Neon Diagonal
45° diagonal with three vibrant stops - popular for landing page heroes.
background: linear-gradient(45deg, #12c2e9 0%, #c471ed 50%, #f64f59 100%);
Muted Diagonal
Soft 135° pastel - works beautifully as a card or modal background.
background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
Dark Diagonal
Dark navy 45° - moody and minimal for dark mode section backgrounds.
background: linear-gradient(45deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
Mesh / Multi-Stop Gradients
CSS mesh gradients layer multiple transparent radial gradients to simulate Figma's mesh fill feature. The technique stacks 4–8 radials at different positions, each fading to transparent, to produce organic blobs of colour.
Mesh Aurora
Six overlapping radials - produces an organic aurora-like mesh effect.
background: radial-gradient(at 40% 20%, hsla(210,100%,74%,1) 0px, transparent 50%), radial-gradient(at 80% 0%, hsla(189,100%,56%,1) 0px, transparent 50%), radial-gradient(at 0% 50%, hsla(355,100%,93%,1) 0px, transparent 50%), radial-gradient(at 80% 50%, hsla(340,100%,76%,1) 0px, transparent 50%), radial-gradient(at 0% 100%, hsla(22,100%,77%,1) 0px, transparent 50%), radial-gradient(at 80% 100%, hsla(242,100%,70%,1) 0px, transparent 50%);
Pastel Mesh
Pastel radial blend - soft and contemporary, great for landing pages.
background: radial-gradient(at 27% 37%, hsla(215, 98%, 61%, 1) 0px, transparent 50%), radial-gradient(at 97% 21%, hsla(125, 98%, 72%, 1) 0px, transparent 50%), radial-gradient(at 52% 99%, hsla(354, 98%, 61%, 1) 0px, transparent 50%), radial-gradient(at 10% 29%, hsla(256, 96%, 67%, 1) 0px, transparent 50%), radial-gradient(at 97% 96%, hsla(38, 60%, 74%, 1) 0px, transparent 50%), radial-gradient(at 33% 50%, hsla(222, 67%, 73%, 1) 0px, transparent 50%);
Warm Mesh
Warm amber-coral mesh - ideal for food, wellness, and creative brands.
background: radial-gradient(at 40% 40%, hsla(28, 100%, 74%, 1) 0px, transparent 50%), radial-gradient(at 90% 10%, hsla(0, 100%, 68%, 1) 0px, transparent 50%), radial-gradient(at 10% 90%, hsla(45, 100%, 68%, 1) 0px, transparent 50%), radial-gradient(at 80% 80%, hsla(340, 100%, 76%, 1) 0px, transparent 50%);
Animated Gradients
CSS gradients themselves cannot be interpolated (browsers can't tween between gradient values directly), but you can animate them by oversizing the background and shifting its position with background-position, or by animating a hue-rotate filter.
Method 1 - Moving background-position
.animated-gradient {
background: linear-gradient(
270deg,
#667eea, #764ba2, #f093fb, #f5576c
);
background-size: 400% 400%;
animation: gradient-shift 8s ease infinite;
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}Method 2 - hue-rotate filter
.hue-animated {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
animation: hue-cycle 6s linear infinite;
}
@keyframes hue-cycle {
from { filter: hue-rotate(0deg); }
to { filter: hue-rotate(360deg); }
}Method 3 - CSS custom property + @property
/* Modern approach - fully interpolatable */
@property --angle {
syntax: '<angle>';
initial-value: 0deg;
inherits: false;
}
.rotating-gradient {
background: conic-gradient(
from var(--angle),
#667eea, #764ba2, #f093fb, #667eea
);
animation: rotate-hue 4s linear infinite;
}
@keyframes rotate-hue {
to { --angle: 360deg; }
}Tips for Accessible Gradient Text
Gradient backgrounds create variable contrast - the contrast ratio at one end may pass WCAG AA while the other end fails. Follow these practices to keep your gradients accessible.
- 1.Test contrast at the lightest AND darkest gradient stop. Both must meet a minimum 4.5:1 ratio for body text.
- 2.Add a semi-transparent overlay (
rgba(0,0,0,0.4)) between the gradient and text to lock the contrast regardless of gradient colour. - 3.Use white or near-white text on dark gradients and dark text on very light or pastel gradients.
- 4.Avoid placing body text directly on a vibrant multi-stop gradient - reserve it for decorative sections only.
/* Safe gradient + text pattern */
.hero {
position: relative;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.hero::after {
content: '';
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.35); /* contrast booster */
}
.hero-content {
position: relative; /* above the ::after overlay */
color: #fff;
}
/* Gradient text (decorative, not body copy) */
.gradient-text {
background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}Key Takeaways
- CSS gradients are
background-imagevalues - they stack like images - Layer multiple radials to create organic mesh effects without libraries
- Animate gradients via
background-positionor@property --angle - Always check contrast at both ends of a gradient before placing text
- Use
-webkit-background-clip: textfor gradient-filled display text - Conic gradients can replace SVG for simple pie charts
Share this article
Create Your Own Gradients
ColorPeek's gradient tools let you build, tweak, and save beautiful gradients with live preview - then copy the CSS instantly or browse curated community palettes for inspiration.