Mesh gradient overlap order: which color shows on top

PublishedToolMesh Gradient Background Generator

Contents
  1. Why Colors Disappear Where Points Overlap: and Why It Matters
  2. How Background Layers Stack: and How to Check
  3. Where People Get Stuck
  4. The Takeaway
  5. Frequently Asked Questions

When you're building a mesh gradient background and move two color points close together, you'll notice the overlap always shows one color while the other seems to vanish. It's not random. Browsers follow a fixed order when they layer multiple background gradients. Once you know that rule, you can predict which point will end up on top.

Quick summary ① When you list multiple gradients in a background separated by commas, the first one is drawn on top, and the rest are layered beneath it in order. ② The Mesh Gradient Background Generator copies the order of the color point list on screen directly into that comma order, so points higher in the list actually appear on top. ③ Newly added color points always go at the end of the list (the bottom layer), so they can be hidden if they overlap existing points.

Why Colors Disappear Where Points Overlap: and Why It Matters

As you build a mesh gradient with 4 or 5 color points and nudge them around, two points will eventually overlap. At that spot, you often see one color clearly instead of a blend of both.

The tricky part is that "which color survives" feels different every time. In some combinations, the point you added later appears on top. In others, the point you added first does. But this isn't random. The result is already determined by the order in which you added the color points.

How Background Layers Stack: and How to Check

You can check this without any tool by using CSS itself. When you list multiple gradients or images in background-image, separated by commas, the browser paints the list from top to bottom. The first value is drawn on top (the layer closest to you), and later values are layered beneath it.

To see it yourself, paste two circles at the same center into Notepad or the Styles panel in your browser's developer tools, like this:

background-image:
  radial-gradient(circle at center, red 0%, transparent 60%),
  radial-gradient(circle at center, blue 0%, transparent 60%);

Save it, and the whole circle looks red, because the red line comes first. Swap the two lines, move blue to the front, and save again. The position hasn't changed, but now the whole circle turns blue. You didn't touch the colors or positions—only the order—and the result flipped.

Check it with our tool. Instead of writing this CSS by hand every time, you can overlap points with sliders and see the result instantly.

Mesh Gradient Background Generator

Free · no sign-up · generates CSS right in your browser

Where People Get Stuck

SymptomCause
The same color always shows at the overlapThat color point is earlier in the list, so it's drawn on top of the other background layers.
I added a new color point but can't see itNew points are appended to the end of the list and sit on the bottom layer, so they're hidden wherever they overlap existing points.
The overlap pattern stays the same when I click RandomizeIt only randomizes colors and positions. The order of the points—and therefore the stacking order—stays the same.
Increasing the spread size makes overlaps more obviousSpread size is the radius each point's color expands to. A larger value increases the area where it overlaps neighboring points.

The Takeaway

  • When you list multiple gradients in a background separated by commas, the first one is drawn on top, and the rest are layered beneath it in order.
  • The Mesh Gradient Background Generator copies the order of the color point list on screen directly into the CSS comma order, so you can tell which color will show at an overlap just by looking at the list.
  • Newly added color points always go at the end of the list, on the bottom layer.
  • This isn't specific to our tool. It's how CSS background-image works, so you can confirm it with your own code by changing only the order.
Mesh Gradient Background Generator

Free · no sign-up · generates CSS right in your browser

Frequently Asked Questions

How do I know which color will appear on top where points overlap?

In the background-image list, the gradient listed first is drawn on top, and the ones after it are layered beneath it in order. The Mesh Gradient Background Generator copies the order of the color point list on screen directly into that comma order, so a point higher in the list is also drawn on top on screen.

Why can't I see a color point I just added?

New color points are always added to the end of the list. In a comma-separated background list, the end is the bottom layer, so if the new point overlaps an existing point, it can be hidden behind it. Move it to an empty spot where it doesn't overlap, and it will appear right away.

How can I change the top-to-bottom order in an overlapping area?

Change the order of the lines listed in background-image in the CSS you copied. Comma-separated background lists stack from top to bottom in any CSS, so move the line with the color you want to the front, and that color will rise to the top. The tool doesn't have a drag-to-reorder feature on screen, but you can delete a point that's on top and recreate it. It gets pushed to the back, which effectively changes the order.

This article was adapted from our Korean original. Read the Korean original

Related articles

  1. iOS vs Android Tab Bars: Why They Differ and How to Build OneSee why iOS and Android tab bars look different, then pick the style you want and copy the HTML and CSS straight into your project.
  2. Bottom tab bar CSS: fix safe-area-inset-bottom on mobileBuild a fixed bottom tab bar for mobile web apps, handle iPhone safe-area-inset-bottom, and design tab styles on screen, then copy the HTML/CSS.
  3. Multi-Layer Box Shadow: Build a 6-Layer CSS ShadowLearn how stacked CSS box-shadow layers work, with offsets and blur doubling per layer, and copy a 6-layer shadow that looks smooth instead of harsh.
  4. Neumorphism Shadows: Why They Look Flat and How to Fix ThemWhy neumorphism shadows look flat, and how light and dark shadows come from one base color, plus the background color rule that makes them work.
  5. Harmonious 5-Color Palette Formula and 60-30-10 Color GuideHow to calculate complementary, analogous and triadic palettes with HSL hue formulas, apply the 60-30-10 ratio, and get HEX codes for UI and web design.
  6. CSS Stripe Pattern Background: repeating-linear-gradient GuideHow to build a 45-degree diagonal stripe background in CSS with repeating-linear-gradient color stops, plus a tool to dial in angle, width, and colors.

Related tools