Back to Snippets

CSS Animated Mesh Gradient Background

A softly moving color field behind a glass content panel. The colors shift and blend continuously with no JavaScript and no image files.

Four radial gradients are layered into a single background-image, one anchored to each corner. The layer is sized at 200 percent, so animating background-position slides those color blobs around inside the box. A 40 pixel blur filter melts their edges together, and that is what turns four separate circles into one mesh.

The keyframes walk the position around all four corners and back to the start, with alternate on the animation so the return trip stays smooth instead of snapping. Swap the four rgba colors for your own palette and keep the alpha well below 1, or the blobs stop blending. Raising the blur makes it softer, lowering it makes the individual gradients readable again.

399
#css
#background
#mesh gradient
#fluid
#blob
#animation
#modern ui
#hero