CSS Gradient Generator: Linear, Radial, and Conic Gradients Explained
Types of CSS Gradients
CSS provides three gradient functions: linear-gradient(), radial-gradient(), and conic-gradient(). All are values of the background-image property — gradients are treated as images in CSS.
Linear Gradients
Linear gradients transition colors in a straight line from one direction to another:
/* Top to bottom (default) */
background: linear-gradient(#3b82f6, #8b5cf6);
/* Left to right */
background: linear-gradient(to right, #3b82f6, #8b5cf6);
/* Diagonal */
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
/* Multiple color stops */
background: linear-gradient(to right, #ef4444, #f97316, #eab308, #22c55e, #3b82f6, #8b5cf6);
Direction can be specified as a keyword (to right, to bottom right) or an angle in degrees (0deg = up, 90deg = right, 180deg = down, 270deg = left).
Radial Gradients
Radial gradients radiate outward from a center point in an ellipse or circle shape:
/* Ellipse from center (default) */
background: radial-gradient(#3b82f6, #8b5cf6);
/* Circle at top-left */
background: radial-gradient(circle at top left, #3b82f6, #8b5cf6);
/* Specific size */
background: radial-gradient(circle 200px at center, #3b82f6, transparent);
Using the Generator
Select linear or radial. The preview updates instantly as you make changes.
Click + to add color stops. Each stop has a color and a position (0–100%). Drag stops to reposition them.
For linear gradients, drag the angle dial or type a degree value. For radial, drag the center point.
Click Copy CSS to get the ready-to-paste background property value.
Mastering Color Stops
Color stops define where each color in the gradient begins and ends. The position (percentage) controls where the transition happens:
/* Hard stop — instant color change at 50% */
background: linear-gradient(to right, red 50%, blue 50%);
/* Delayed transition — hold red until 30%, then transition to blue */
background: linear-gradient(to right, red, red 30%, blue);
/* Multiple stops with explicit positions */
background: linear-gradient(to right,
#ef4444 0%,
#ef4444 25%, /* solid red for first quarter */
#3b82f6 75%, /* solid blue for last quarter */
#3b82f6 100%
);
Design Tips
- Use HSL for natural transitions — gradients between two colors that are far apart on the color wheel often look muddy in the middle. Try intermediate color stops in HSL to steer around the gray zone.
- Subtle gradients — single-hue gradients (same hue, slightly different lightness) look more professional and modern than dramatic multi-color gradients for backgrounds.
- Layer gradients — CSS allows multiple background layers:
background: linear-gradient(...), linear-gradient(...). Use this for complex effects like overlaying a color tint on a background image. - Accessibility — don't rely on gradient colors alone to convey information. Ensure text placed over gradients passes contrast requirements at every point in the gradient.
