CSS gradients create smooth color transitions directly in the browser. Choose a linear gradient for a transition along a line, a radial gradient for color spreading from a point, or a conic gradient for color arranged around a center. Each is an image value built from color stops, so use it in an image-capable property such as background-image—not background-color.
What a CSS gradient is—and where it works
A CSS gradient is a browser-generated <image> value, not a bitmap file or a color value. The browser draws it from the CSS instructions, so the gradient can adapt to the size of the element it fills without requiring a separate raster image. Gradients have no intrinsic dimensions; their rendered size comes from the element or an explicitly specified image size. See MDN’s reference for the CSS <gradient> type.
As an Amazon Associate I earn from qualifying purchases.
Use a gradient in properties that accept images, including background-image and the background shorthand. It is not valid as the value of background-color, which accepts colors rather than images. For example:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
.banner {
background-image: linear-gradient(90deg, #173b69, #56a8d8);
}
.card {
background-color: #f4f6f8;
background-image: radial-gradient(circle, #fff, #dce7f2);
}
The second example keeps a plain color behind the gradient. That can be useful as a fallback, but it does not change the fact that the gradient itself belongs in an image-valued property.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Choose a gradient by its geometry
The key difference among the main gradient functions is the path along which the color transition occurs. MDN’s guide to using CSS gradients covers the available forms and their controls.
| Type | How color transitions | Typical use |
|---|---|---|
| Linear | Along a straight line | Directional fades, such as a dark overlay from one side of an image |
| Radial | Outward from an origin | A spotlight, glow, or circular fade |
| Conic | Around a center point, like an arc rotating around its origin | Color arranged by angle around a center |
Linear: transition along a line
linear-gradient() transitions between color stops along a straight line. With no direction specified, the gradient runs from top to bottom. A direction keyword or angle changes its orientation. Angle direction can be unintuitive: 0deg runs from bottom to top, while 90deg runs from left to right; angles increase clockwise.
Rank #2
background-image: linear-gradient(90deg, navy, skyblue);
background-image: linear-gradient(to bottom, #202b40, transparent);
The first example moves left to right. In the second, the direction is stated in words and the transition runs from top to bottom.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRadial: transition outward from an origin
radial-gradient() radiates colors from an origin. You can adjust the shape and size and place the origin within or outside the image area. That positioning makes radial gradients useful when the color should appear to emanate from a particular part of an element rather than follow a straight direction.
Rank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
background-image: radial-gradient(circle at 30% 40%, #fff4b8, #dd7a3c, #472b55);
Conic: transition around a center
conic-gradient() transitions around a center point rather than radiating outward. The center position and color-stop positions can be adjusted. Think of its color sequence as turning around the origin: the transition is angular, not a straight-line fade or an outward spread.
Control transitions with color stops
A basic linear gradient needs at least two color stops. Each stop names a color; optional positions determine where that color appears along the gradient. Add more stops to create a multi-color transition or place stops precisely to control how much space each color occupies.
Rank #4
background-image: linear-gradient(
90deg,
#10233f 0%,
#2877a8 55%,
#d5f2ed 100%
);
Here, the first color is placed at the start, the middle color at 55%, and the final color at the end. The percentages are stop positions, not separate colors. The same general idea—choosing colors and positioning their stops—shapes the appearance of radial and conic gradients too.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Make a repeating pattern
The repeating functions—repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient()—repeat a stop pattern to fill the image area. The interval is determined by the positions of the first and last stops, so those positions define the pattern unit.
Best Value
background-image: repeating-linear-gradient(
45deg,
#eee 0 10px,
#555 10px 20px
);
This example repeats alternating light and dark bands. Repeating gradients are appropriate when you want a CSS-drawn pattern rather than one transition across the whole element.
Repeating conic gradients and angle positions
A full turn in a repeating conic gradient is 360 degrees. MDN notes that browsers supporting repeating-conic-gradient() also accept percentage stop positions, treating 100% as 360 degrees, but that percentage behavior is not specified. Prefer angle positions when your code needs to rely on specified syntax. MDN labels repeating-conic-gradient() “Baseline Widely available” and reports browser availability since November 2020; some support details can vary. Check compatibility data if targeting legacy browsers or relying on nuanced syntax. See the MDN reference for repeating-conic-gradient().
Accessibility: do not put essential meaning only in a background
Assistive technology does not treat a CSS background image as meaningful document content, and screen readers do not announce its presence. A purely decorative gradient generally does not need an equivalent description. But if color or a gradient pattern conveys information a reader needs, provide that information in semantic page content as well—for example, with visible text or a meaningful label. The gradient can reinforce the message; it should not be the only way to receive it.
Quick Recap
A practical choice checklist
- Choose
linear-gradient()when the transition should follow a straight direction. - Choose
radial-gradient()when color should spread from a positioned origin. - Choose
conic-gradient()when colors should transition around a center. - Choose a repeating variant when the stop pattern should tile across the rendered image.
- Set stop positions when the transition’s color placement needs more control.
- Use an image-capable CSS property, and put any information conveyed by the visual into semantic page content too.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




