Mesh Gradients in Tailwind CSS: A Visual Guide

September 28, 2026  |  10 min read  |  Tailwind CSS

By Syed · Frontend Engineer & Creator of UITweak

Open any standout landing page from the last few years, Stripe, Linear, Raycast, and you'll likely find a mesh gradient behind the hero: soft pools of color melting into each other with a depth that flat linear gradients can't touch. They look complex, but the technique is surprisingly simple: a mesh gradient is just several radial gradients stacked in a single background declaration.

This guide walks through building them by hand in CSS, translating them into Tailwind CSS arbitrary values, adding smooth animation, and avoiding the common pitfalls, with code you can copy straight into your project.

What Are Mesh Gradients?

A mesh gradient is a background made of multiple colored “nodes”, soft radial blobs placed at different positions, that blend into one another. Compare:

  • Linear gradient: colors blend along a straight line. Predictable, flat, a bit boring.
  • Radial gradient (single): one color fading outward from a point. Nice glow, but lonely.
  • Mesh gradient: four or five radial gradients layered together. Colors pool, overlap, and interact, creating organic depth.

That interaction is the whole point. Where two nodes overlap, the colors mix the way paint mixes, which is why mesh gradients feel richer than anything a single gradient function can produce.

The Building Block: Layered radial-gradient

CSS lets you comma-separate multiple backgrounds, painting the first one on top. A mesh gradient exploits this: each layer is a radial gradient positioned with at <x>% <y>%, fading to transparent:

.mesh {
  background:
    radial-gradient(at 20% 30%, #ff6b9d 0px, transparent 50%),
    radial-gradient(at 80% 20%, #4facfe 0px, transparent 50%),
    radial-gradient(at 60% 80%, #a855f7 0px, transparent 50%),
    radial-gradient(at 30% 70%, #fbbf24 0px, transparent 50%),
    #0f172a; /* base color fills the gaps */
}

How to read this:

  • at 20% 30%: the center of this color node sits 20% from the left, 30% from the top. Move these numbers to rearrange the composition.
  • #ff6b9d 0px, transparent 50%: the color is solid at the center and fully transparent halfway across the element. The fade distance controls how soft each blob is; larger percentages mean dreamier blends.
  • #0f172a last: a plain color at the end of the list acts as the base coat underneath everything, so there are no unpainted gaps.

Two refinements worth knowing. First, add the circle keyword if you want perfectly round blobs instead of ellipses that stretch with the element:

radial-gradient(circle at 20% 30%, #ff6b9d 0px, transparent 50%)

Second, always set a matching background-color as a fallback for ancient browsers that choke on multiple backgrounds:

.mesh {
  background-color: #0f172a;
  background-image:
    radial-gradient(circle at 20% 30%, #ff6b9d 0px, transparent 50%),
    radial-gradient(circle at 80% 20%, #4facfe 0px, transparent 50%);
}

Adding Depth with Blend Modes

Here's what separates a decent mesh gradient from a stunning one: background-blend-mode. By default, layers just stack with normal alpha compositing. Blend modes change how overlapping nodes mix:

.mesh-vivid {
  background-color: #0b1020;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255, 107, 157, 0.9), transparent 60%),
    radial-gradient(circle at 75% 30%, rgba(79, 172, 254, 0.9), transparent 60%),
    radial-gradient(circle at 50% 85%, rgba(168, 85, 247, 0.9), transparent 60%);
  background-blend-mode: screen;
}

The modes worth trying, in order of usefulness:

  • screen: lightens where nodes overlap. Best for dark bases; makes colors glow.
  • overlay: boosts contrast in overlaps. Punchier, more dramatic.
  • multiply: darkens overlaps. Works on light bases for a watercolor feel.
  • soft-light: subtle version of overlay when the effect is too strong.

Note the rgba() colors with 0.9alpha here instead of hex. When blend modes are in play, slightly transparent nodes mix more naturally than fully opaque ones. Experiment, this is the part that's genuinely fun to eyeball.

Mesh Gradients in Tailwind CSS

Tailwind doesn't have a mesh-gradient utility, but arbitrary values get you there in a single class. The rule: underscores stand in for spaces:

<div class="min-h-screen bg-[#0f172a] bg-[radial-gradient(circle_at_20%_30%,#ff6b9d_0,transparent_50%),radial-gradient(circle_at_80%_20%,#4facfe_0,transparent_50%),radial-gradient(circle_at_60%_80%,#a855f7_0,transparent_50%)]">
  <!-- hero content -->
</div>

That works, but be honest with yourself: it's unreadable, unmaintainable, and you'll never want to tweak it. For anything beyond a quick prototype, define a proper utility class in your CSS file and use a clean class name:

/* In your globals.css / input.css */
@layer utilities {
  .mesh-hero {
    background-color: #0f172a;
    background-image:
      radial-gradient(circle at 20% 30%, #ff6b9d 0px, transparent 50%),
      radial-gradient(circle at 80% 20%, #4facfe 0px, transparent 50%),
      radial-gradient(circle at 60% 80%, #a855f7 0px, transparent 50%),
      radial-gradient(circle at 30% 70%, #fbbf24 0px, transparent 50%);
  }
}
<div class="mesh-hero min-h-screen">
  <!-- hero content -->
</div>

If you're on Tailwind v4, you can register it as a theme utility with @utility so it composes with variants like dark: and md:. Either way, the principle holds: arbitrary values for experiments, named classes for production. For the plain-CSS deep dive (node placement, blend modes, animation), see our mesh gradients in CSS guide.

Animated Mesh Gradients

Static mesh gradients are beautiful; animated ones are unforgettable. There are two approaches, and one is clearly better.

The right way: animated blurred blobs

Instead of animating the gradient itself, place absolutely-positioned divs with huge blur radii behind your content and animate them with transform, which is GPU-accelerated and buttery smooth:

<div class="hero">
  <div class="blob blob-1"></div>
  <div class="blob blob-2"></div>
  <div class="blob blob-3"></div>
  <div class="hero-content">
    <h1>Ship something beautiful</h1>
  </div>
</div>
.hero {
  position: relative;
  overflow: hidden;
  background: #0b1020;
  min-height: 100vh;
}

.blob {
  position: absolute;
  width: 42vmax;
  height: 42vmax;
  border-radius: 9999px;
  filter: blur(90px);
  opacity: 0.65;
  animation: drift 18s ease-in-out infinite alternate;
}

.blob-1 { background: #ff6b9d; top: -10%; left: -10%; }
.blob-2 { background: #4facfe; top: 20%; right: -15%; animation-delay: -6s; }
.blob-3 { background: #a855f7; bottom: -20%; left: 30%; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(8vw, -6vh) scale(1.25); }
}

.hero-content {
  position: relative;
  z-index: 1;
}

The negative animation-delay values are the secret sauce: they start each blob mid-cycle so the composition looks organic on first paint instead of everything sliding in from the same spot.

The simpler way: animating background-position

You can animate a static layered gradient by shifting background-position, but every layer moves together and browsers repaint rather than composite, noticeably less smooth on mid-range phones. It works in a pinch:

.mesh-animated {
  background-size: 200% 200%;
  animation: pan 20s ease-in-out infinite alternate;
}

@keyframes pan {
  from { background-position: 0% 0%; }
  to   { background-position: 100% 100%; }
}

Prefer the blob technique for hero sections; reserve background-position animation for small decorative areas.

Respect reduced motion

Any animation should switch off for users who ask for it:

@media (prefers-reduced-motion: reduce) {
  .blob, .mesh-animated { animation: none; }
}

Practical Tips

Keep text readable. Mesh gradients are busy by design. Either place text in a quieter region of the composition, or add a readability layer, a dark overlay (bg-black/40) or a subtle top-to-bottom scrim behind headings:

.scrim {
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent 60%);
}

Limit your palette. Three to four nodes in analogous colors (neighbors on the color wheel) look premium; six clashing neons look like a 2008 Winamp skin. When in doubt: pick one hero color, two supporting colors, one dark base.

Watch mobile performance. filter: blur(90px) over a 42vmax element is one of the most expensive things you can ask a phone GPU to do. On small screens, shrink the blobs and reduce the blur:

@media (max-width: 640px) {
  .blob { width: 70vw; height: 70vw; filter: blur(50px); }
}

Mind the edges. Nodes positioned near 0% or 100% get cut by the element edge, which can create harsh lines. Either keep nodes comfortably inside, or let the parent overflow: hidden crop them intentionally with enough bleed.

FAQ

What's the difference between a radial gradient and a mesh gradient?

A mesh gradient is multiple radial gradients layered in one background declaration. A single radial gradient gives you one glow; a mesh gives you an interacting field of color.

Can I build mesh gradients in Tailwind without custom CSS?

Yes, arbitrary values like bg-[radial-gradient(...)]with underscores for spaces. But for production, define a named utility class; it's far easier to maintain and tweak.

Why does my mesh gradient look banded or flat?

Usually one of three causes: nodes are too far apart (increase the fade percentage), colors are too similar (add contrast), or you're missing a blend mode (screen on dark bases works wonders).

Are animated gradients bad for performance?

Transform-based blob animation is GPU-composited and generally fine. Animating background-position triggers repaints and is heavier, and large blur radii are costly on mobile regardless, so scale them down with a media query.

How do I choose colors for a mesh gradient?

Start with 3–4 analogous colors plus a dark base. If color theory isn't your thing, pull a palette from a photo you like, or use a visual generator to audition combinations live before committing.

Do mesh gradients work in dark mode designs?

They're arguably best in dark mode, vivid nodes over a near-black base (#0b1020-style) with screen blend mode is the signature look of modern dev-tool landing pages.

Stop Guessing Node Positions

Hand-tuning at 20% 30%values across four layers, then re-tuning when the blend looks muddy, is slow, and you can't see the result until you refresh. The free Mesh Gradient Generator lets you drag color nodes around a live canvas, switch blend modes per node, dial in animated float/pulse/orbit modes, and export the finished CSS, including the @keyframes, plus Tailwind, React, and Vue formats. Design it visually, ship the code.

Share this guide