CSS Mesh Gradient

A dreamy pastel mesh gradient built from layered radial gradients.

  • mesh
  • radial
  • pastel
  • background
HTML
<div class="mesh-gradient"></div>
CSS
.mesh-gradient {
  background-color: #ff99cc;
  background-image:
    radial-gradient(at 15% 20%, #ffd3a5 0, transparent 55%),
    radial-gradient(at 85% 15%, #a0c4ff 0, transparent 55%),
    radial-gradient(at 75% 85%, #bdb2ff 0, transparent 55%),
    radial-gradient(at 10% 90%, #9bf6ff 0, transparent 55%);
}

About this CSS Mesh Gradient

This CSS Mesh Gradient is 8 lines of pure CSS (0.3 KB) with no JavaScript and no dependencies. It uses radial gradients. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #ff99cc
  • #ffd3a5
  • #a0c4ff
  • #bdb2ff
  • #9bf6ff

How to use this mesh gradient

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .mesh-gradient class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback