October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

CSS Gradients: The Complete Guide to Linear, Radial, Conic, and Repeating Effects

A practical guide to CSS gradients: understand their geometry, control color stops, create repeating patterns, and avoid relying on backgrounds for essential meaning.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.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
Sale
HTML and CSS: Design and Build Websites
  • 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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Radial: 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
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • 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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make 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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.