If you’ve been searching for the “Apple Liquid Glass” style, you’re in the right place. You may already be familiar with traditional “glassmorphism,” the popular design trend that uses backdrop-filter: blur() to create a frosted glass look.This article introduces the “Apple Liquid Glass” technique, a new way to achieve a more realistic and dynamic result. We’ll break down how to create its signature rippling distortion using a clever combination of layered HTML elements, CSS, and a powerful SVG filter. We’ll be referencing the code from the “Glassmorphism Music Player” example.
The Core Concept: Stacking Layers
The entire effect relies on stacking four distinct layers on top of each other using CSS positioning and z-index.
Imagine it like a sandwich:
- Content (Top Layer, z-index: 3) – Your text, images, and buttons.
- Specular Highlight (Middle Layer, z-index: 2) – A subtle inner border to catch the “light.”
- Glass Overlay (Middle Layer, z-index: 1) – The semi-transparent background color.
-
Filter Layer (Bottom Layer, z-index: 0) – The magic layer that distorts everything behind it.
-
The HTML Structure
First, you need a container for all these layers. Inside, you’ll have the layers themselves, plus a final element for your actual content.
- The CSS Layers
Now, let’s style those layers. The key is to use position: absolute and inset: 0 to make them all fill the .glass-container perfectly, then control their stacking with z-index.
/* The main container holds all the layers
*/
.glass-container {
position: relative;
border-radius: 1rem; /* Or any border-radius you want */
overflow: hidden; /* Crucial to contain the effect */
}
/* Layer 4: The Distortion Filter */
.glass-filter {
position: absolute;
inset: 0;
z-index: 0;
/* This is the key! We set blur(0px) to enable backdrop-filter,
but use our custom SVG filter for the *actual* effect.
*/
backdrop-filter: blur(0px);
filter: url(#lg-dist); /* This points to our SVG filter's ID */
/* Fixes stacking context issues in some browsers */
isolation: isolate;
}
/* Layer 3: The Semi-Transparent Background */
.glass-overlay {
position: absolute;
inset: 0;
z-index: 1;
background: rgba(255, 255, 255, 0.25); /* Your glass color */
}
/* Layer 2: The "Light" Highlight */
.glass-specular {
position: absolute;
inset: 0;
z-index: 2;
border-radius: inherit; /* Matches the parent's border-radius */
overflow: hidden;
box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.75),
inset 0 0 5px rgba(255, 255, 255, 0.75);
}
/* Layer 1: Your Content */
.glass-content {
position: relative; /* Sits normally on top */
z-index: 3;
padding: 1rem; /* Give your content some space */
}
- The Magic: Breaking Down the SVG Filter
The real star of the “Apple Liquid Glass” effect is the . It works in three steps:
- : This creates a “noise” pattern, like static on an old TV. We use type=”fractalNoise” to make it look more natural and organic.
- : The raw noise is too sharp. We apply a simple blur to it, which makes the noise “clump” together into softer, blob-like shapes.
- : This is the mind-bending part. It takes the blurred noise pattern and uses it as a map to distort the original content (in=”SourceGraphic”). The scale=”70″ attribute controls how intense the ripple effect is.
And that’s it! By combining these CSS layers with the power of SVG filters, you move beyond simple blurring and create a truly unique and dynamic “Apple Liquid Glass” effect.
Browser Compatibility
This effect relies on two key technologies, and their support is very good, but not universal.
-
SVG Filters (feTurbulence, etc.): This is the core of the “liquid” look. SVG filters are widely supported across all modern browsers, including Chrome, Firefox, Safari, and Edge. You can use this part of the effect with high confidence.
-
backdrop-filter: This is what allows the element to distort the content behind it.Supported: Safari (all versions), Chrome, Edge, and Firefox (v103+).Not Supported: Internet Explorer.
In summary: The effect will work perfectly for the vast majority of users on modern browsers. For browsers that don’t support backdrop-filter, the “liquid” distortion won’t apply to the background image, but the element will still have its semi-transparent background and specular highlight, gracefully degrading to a simpler glassmorphism effect.