If you’ve ever wanted your web designs to look alive — as if the glass surface itself were flowing like water — you’ll love this trick.
In this tutorial, we’ll build a realistic liquid glass effect using CSS + SVG filters. It’s lightweight, modern, and doesn’t need WebGL or heavy animations.
#🧠 Concept Overview
Most “liquid glass” effects use blur and transparency, but with an SVG filter, we can go one step further — by distorting what’s behind the glass, like light refracting through water.
We’ll use two SVG filter primitives:
<feTurbulence>– generates a dynamic noise texture that looks like waves.<feDisplacementMap>– distorts the element’s pixels using that noise pattern.
By animating the turbulence frequency, the noise pattern shifts subtly over time, giving that organic, water-like shimmer.
#🧩 Step 1: The HTML Setup
We’ll define an SVG filter once in the page and reference it in our CSS.
1<svg width="0" height="0">>
2 <filter id="liquid">
3 <feTurbulence id="turbulence" baseFrequency="0.02" numOctaves="3" result="noise" />
4 <feDisplacementMap in="SourceGraphic" in2="noise" scale="20" />
5 </filter>
6</svg>
7
8<div class="glass-card">
9 <h2>Liquid Glass</h2>
10 <p>Now with realistic water motion!</p>
11</div>
#💡 How it works
<feTurbulence>creates a fractal-like noise texture.<feDisplacementMap>uses that texture to push and pull pixels — bending light like rippling water.- The filter is invisible, but its distortion is applied to the
.glass-cardelement viafilter: url(#liquid);.
#🎨 Step 2: The CSS Styling
Now let’s make our glass card look frosted and elegant.
1body {
2 background: url('https://picsum.photos/1200/800') no-repeat center center/cover;
3 min-height: 100vh;
4 display: flex;
5 justify-content: center;
6 align-items: center;
7 font-family: 'Poppins', sans-serif;
8}
9
10.glass-card {
11 width: 320px;
12 padding: 2rem;
13 border-radius: 20px;
14 background: rgba(255, 255, 255, 0.15);
15 backdrop-filter: blur(12px);
16 -webkit-backdrop-filter: blur(12px);
17 border: 1px solid rgba(255, 255, 255, 0.3);
18 color: white;
19 text-align: center;
20 filter: url(#liquid);
21 box-shadow: 0 8px 32px rgba(0,0,0,0.25);
22}
At this stage, your card looks like elegant frosted glass — but still static.
Let’s make it move like liquid.
#⚡ Step 3: Adding the Water Animation
To make the distortion dynamic, we’ll animate the baseFrequency attribute of <feTurbulence> using a few lines of JavaScript:
1<script>
2 const turbulence = document.querySelector("#turbulence");
3 let frame = 0;
4
5 function animate() {
6 frame += 0.005;
7 const freq = 0.006 + Math.sin(frame) * 0.005;
8 turbulence.setAttribute("baseFrequency", freq);
9 requestAnimationFrame(animate);
10 }
11
12 animate();
13</script>
💧 What’s happening:
baseFrequencycontrols how “tight” or “loose” the noise pattern is.- By oscillating it with a sine wave, we get a gentle, fluid shimmer effect.
- The result is smooth, natural motion — no CSS keyframes needed.
#✨ Step 4: See It in Action
When you put it all together, you’ll see a glass panel that looks as if water is flowing beneath the surface.
The background blurs and bends realistically, catching the light in motion — just like a piece of living glass.
#⚙️ Performance Notes
- SVG filters are GPU-accelerated in most modern browsers.
- Keep the
scalevalue in<feDisplacementMap>moderate (10–30) for smooth rendering. - Works best on desktop browsers and high-end mobile devices.
If you need wide compatibility, consider a CSS fallback (like static glassmorphism) for older browsers.
#🧩 Bonus: Customization Tips
Here’s a quick reference for tweaking your liquid glass effect:
| Feature | Attribute | Example Value | Effect |
|---|---|---|---|
| Wave intensity | scale |
10–40 |
Controls how much pixels distort |
| Wave complexity | numOctaves |
2–5 |
Adds texture depth |
| Motion speed | JS increment | 0.005 |
Faster or slower wave movement |
| Base smoothness | baseFrequency |
0.01–0.05 |
Controls wave size |
Try tweaking these values for anything from gentle ripples to stormy water.
#🪄 Final Thoughts
This technique combines the power of CSS, SVG filters, and a touch of JavaScript to create one of the most realistic liquid effects you can achieve without heavy graphics engines.
Use it on:
- Glass cards and modals
- Hero sections
- Interactive dashboards
- Futuristic UI designs
With just a few lines of code, you can turn ordinary glassmorphism into a living, liquid masterpiece.