SnippetUI

Animated Mesh Gradient

A dynamic mesh gradient background with smoothly transitioning colors, built entirely with CSS.

HTMLCSS

An animated mesh gradient background that smoothly blends and moves multiple overlapping gradients using CSS radial-gradient and filter: blur().

Preview

Mesh Gradient

Smooth flowing colors

Use Cases & Features

This animated mesh gradient is perfect for website backgrounds where you want to create a modern and dynamic impression.

  • Hero Sections: The first impression of a landing page to captivate visitors’ attention.
  • Login / Sign-up Screens: Turns often-boring authentication screens into attractive visual experiences.
  • Card Backgrounds: Backgrounds for credit card UIs or other premium elements.
  • Features:
    • Built entirely with CSS; lightweight without relying on Canvas or WebGL.
    • Beautiful and natural color blending achieved with mix-blend-mode: screen and filter: blur().
    • Performance optimized with the application of will-change: transform.

Design & UX Insights

  • Smooth Motion: By offsetting the animation duration of each circular element, it creates irregular, organic, and natural movement.
  • Color Harmony: Utilizes contrasting neon pink, vivid blue, cyan, and yellow, designed to produce deep and rich colors when blended together.
  • Glassmorphism Synergy: Applying a backdrop-filter (background blur) to the foreground content creates a modern design where the underlying gradient shines through.

Customization Guide

  • Changing Colors: You can modify the radial-gradient colors inside the .mesh-blob-* classes to match your brand’s color palette.
  • Adjusting Movement: Reducing the translate values in the @keyframes float* animations will result in calmer, more subtle movement.
  • Blur Intensity: By tweaking the filter: blur(60px) value in .mesh-bg, you can make the color blending either sharper or even smoother.

Implementation Code

<div class="mesh-container">
<div class="mesh-bg">
  <div class="mesh-blob mesh-blob-1"></div>
  <div class="mesh-blob mesh-blob-2"></div>
  <div class="mesh-blob mesh-blob-3"></div>
  <div class="mesh-blob mesh-blob-4"></div>
</div>
<div class="mesh-content">
  <h3 class="mesh-title">Mesh Gradient</h3>
  <p class="mesh-subtitle">Smooth flowing colors</p>
</div>
</div>

<style>
.mesh-container {
position: relative;
width: 100%;
height: 400px;
overflow: hidden;
border-radius: 16px;
background-color: #030014;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Inter', system-ui, sans-serif;
}

.mesh-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
filter: blur(60px);
z-index: 0;
opacity: 0.9;
}

.mesh-blob {
position: absolute;
border-radius: 50%;
mix-blend-mode: screen;
will-change: transform;
}

.mesh-blob-1 {
width: 400px;
height: 400px;
background: radial-gradient(circle, rgba(255, 0, 204, 0.8) 0%, rgba(255, 0, 204, 0) 70%);
top: -100px;
left: -100px;
animation: float1 15s infinite ease-in-out;
}

.mesh-blob-2 {
width: 500px;
height: 500px;
background: radial-gradient(circle, rgba(51, 51, 255, 0.8) 0%, rgba(51, 51, 255, 0) 70%);
bottom: -150px;
right: -100px;
animation: float2 18s infinite ease-in-out;
}

.mesh-blob-3 {
width: 450px;
height: 450px;
background: radial-gradient(circle, rgba(0, 255, 255, 0.6) 0%, rgba(0, 255, 255, 0) 70%);
top: 50px;
right: -50px;
animation: float3 20s infinite ease-in-out;
}

.mesh-blob-4 {
width: 350px;
height: 350px;
background: radial-gradient(circle, rgba(255, 204, 0, 0.6) 0%, rgba(255, 204, 0, 0) 70%);
bottom: 0px;
left: 50px;
animation: float4 22s infinite ease-in-out;
}

@keyframes float1 {
0% { transform: translate(0px, 0px) scale(1); }
33% { transform: translate(100px, 150px) scale(1.2); }
66% { transform: translate(-50px, 50px) scale(0.9); }
100% { transform: translate(0px, 0px) scale(1); }
}

@keyframes float2 {
0% { transform: translate(0px, 0px) scale(1); }
33% { transform: translate(-150px, -100px) scale(1.3); }
66% { transform: translate(100px, -50px) scale(0.8); }
100% { transform: translate(0px, 0px) scale(1); }
}

@keyframes float3 {
0% { transform: translate(0px, 0px) scale(1); }
33% { transform: translate(-100px, 100px) scale(1.1); }
66% { transform: translate(150px, -150px) scale(1.2); }
100% { transform: translate(0px, 0px) scale(1); }
}

@keyframes float4 {
0% { transform: translate(0px, 0px) scale(1); }
33% { transform: translate(150px, -150px) scale(0.9); }
66% { transform: translate(-150px, 150px) scale(1.3); }
100% { transform: translate(0px, 0px) scale(1); }
}

.mesh-content {
position: relative;
z-index: 1;
text-align: center;
color: white;
background: rgba(255, 255, 255, 0.05);
padding: 40px 60px;
border-radius: 24px;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.mesh-title {
margin: 0;
font-size: 2.5rem;
font-weight: 700;
letter-spacing: -1px;
background: linear-gradient(135deg, #fff, #e0e0e0);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

.mesh-subtitle {
margin: 10px 0 0;
font-size: 1.1rem;
font-weight: 400;
color: rgba(255, 255, 255, 0.7);
}
</style>

Browser Support

  • Chrome: Supported
  • Firefox: Supported
  • Safari: Supported (requires -webkit-backdrop-filter)
  • Edge: Supported