How to Create Modern Animated Mesh Gradients in CSS

The Quick Answer

To create a static mesh gradient in CSS, layer multiple radial-gradient() declarations separated by commas on background-image, pinning each to a different focal point (e.g. at 0% 0%, at 100% 100%). For fluid animated mesh gradients, render 4 blurred color spheres inside an overflow: hidden container and animate their positions using GPU-accelerated transform: translate3d().

Interactive Mesh Playground (Tweak Blur & Speed) GPU Animated
Fluid Organic Mesh
Pure CSS + GPU Composition
70px
Normal

Method 1: The Multi-Stop Radial Gradient (Zero DOM Elements)

For static hero sections where you don't need motion, multiple radial gradients combined on a single element require zero extra HTML elements and render instantaneously:

static-mesh.css
.mesh-container {
  background-color: #0f172a;
  background-image:
    radial-gradient(at 0% 0%, #6366f1 0px, transparent 50%),
    radial-gradient(at 100% 0%, #ec4899 0px, transparent 50%),
    radial-gradient(at 100% 100%, #10b981 0px, transparent 50%),
    radial-gradient(at 0% 100%, #06b6d4 0px, transparent 50%);
  width: 100%;
  min-height: 480px;
}

Method 2: High-Performance GPU-Animated Mesh

To make the colors swirl smoothly like the Stripe or Apple landing pages, animate individual color nodes using transform: translate3d(). This keeps CPU usage near 0% because the browser offloads the motion to the hardware compositor:

animated-mesh.css
/* Container traps the blurred orbs */
.animated-mesh-stage {
  position: relative;
  overflow: hidden;
  background: #09090d;
}

/* Individual Color Orbs */
.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}

.orb-pink {
  width: 320px;
  height: 320px;
  background: #ec4899;
  animation: floatOrb1 14s ease-in-out infinite alternate;
}

.orb-indigo {
  width: 380px;
  height: 380px;
  background: #6366f1;
  animation: floatOrb2 18s ease-in-out infinite alternate;
}

/* Smooth Compositor Keyframes */
@keyframes floatOrb1 {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(120px, 80px, 0) scale(1.15); }
  100% { transform: translate3d(-60px, 140px, 0); }
}

@keyframes floatOrb2 {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-100px, -60px, 0) scale(0.9); }
  100% { transform: translate3d(80px, -110px, 0); }
}

Next-Level Addons: Supercharging Your Mesh Background

Once your fluid mesh gradient is rendering smoothly, take it further by integrating textures, floating glass containers, and synchronized keyframe physics:

Frosted Glass Overlay
Dynamic Mesh Blur

1. Frosted Glassmorphism Overlays

Explore in Glassmorphism Studio →

Vibrant animated mesh gradients provide the ideal optical canvas for frosted glass navigation bars, modals, and pricing cards. Because the colors behind the glass are in constant motion, the backdrop-filter: blur() effect creates an ever-evolving ambient light display.

Dithered Mesh Anti-Banding

2. Micro-Noise Dithering to Kill Color Banding

Explore in Noise Studio →

Large gradients with soft transitions often exhibit visible step-banding on wide monitors. Stacking a transparent SVG fractal noise filter over the mesh background creates micro-dithering that blends color boundaries seamlessly.

Mesh Gradient + Asymmetric Easing

3. Easing Curves & Asymmetric Timelines

Explore in Animation Studio →

Avoid symmetric, robotic looping by giving each colored orb an independent animation duration (e.g. 13s, 17s, 23s) using prime numbers. This prevents the pattern from visibly repeating and maintains organic fluid motion.

Chaam
Chaam's Pro Tip

A trick I use in almost every project: don't fight specificity battles with !important. Leverage modern CSS cascade layers (@layer) and CSS variables as design tokens—it makes dark/light theme switching and responsive tuning effortless.

Generate Custom CSS & Canvas Mesh Gradients Visually

Choose from 20+ designer color palettes, adjust focal points with drag-and-drop handles, and export production CSS or SVG code instantly.

Open Mesh Gradient Studio ↗

Frequently Asked Questions

Practical answers to common questions about CSS mesh gradients, GPU compositing, and Tailwind CSS integration.

Can you create a true mesh gradient with pure CSS?

Yes. While the CSS specification does not yet have a standalone mesh-gradient() function, layering multiple radial-gradient() declarations with transparent fade stops creates an authentic, blended organic mesh gradient without third-party graphics tools or JavaScript.

How do you animate CSS mesh gradients smoothly without CPU lag?

Never animate background-position or color stops directly. Animating background properties forces the browser to recalculate layouts and perform expensive repaints on every frame.

Instead, place 3–5 colored circular divs inside a container, apply filter: blur(...), and animate their positions using transform: translate3d(x, y, 0). This leverages the GPU compositor layer, ensuring fluid 60fps performance even on laptops and mobile devices.

How do you use CSS mesh gradients in Tailwind CSS v3 and v4?

In Tailwind CSS v3, you can use arbitrary values:

<div class="bg-[radial-gradient(at_0%_0%,#6366f1_0px,transparent_50%),radial-gradient(at_100%_100%,#ec4899_0px,transparent_50%)] bg-slate-900">

In Tailwind CSS v4, define your custom mesh theme variable in your main CSS file:

@theme {
  --background-image-hero-mesh: radial-gradient(at 0% 0%, #6366f1, transparent 50%), radial-gradient(at 100% 100%, #ec4899, transparent 50%);
}
What is the performance difference between CSS blur mesh and HTML5 Canvas mesh?

CSS mesh gradients created with translated orbs and filter: blur() run directly on the browser's GPU compositor thread, making them extremely efficient for modern desktop and mobile browsers.

HTML5 Canvas mesh gradients recalculate pixel matrices using JavaScript, which can consume more main-thread CPU unless written with custom WebGL fragment shaders. For landing pages and UI hero cards, CSS GPU compositing is vastly lighter on battery and memory.

Can you export CSS mesh gradients as responsive SVG images?

Yes. You can enclose SVG <radialGradient> nodes and <feGaussianBlur> filter primitives inside a standalone .svg file.

This allows you to use your mesh gradient as a responsive vector background image via an <img> tag or CSS background-image: url(...) property without writing custom HTML divs or JavaScript animation loops.

← Previous: CSS Glassmorphism Guide Back to all guides →