Generate CSS code for modern frosted-glass card designs.
The defining characteristic of "Glassmorphism" is the frosted-glass effect, where whatever is behind the element appears blurred and desaturated.
In CSS, the standard filter: blur(10px) property blurs the element itself (and its text/children). To achieve glassmorphism, we must use backdrop-filter: blur(10px). This instructs the browser to apply the blur only to the visual layers logically underneath the element.
backdrop-filter is notoriously expensive for a computer's GPU.
When rendering a frame, the browser must take a "screenshot" of everything structurally beneath the element, apply a mathematically heavy Gaussian blur algorithm to that screenshot, and then composite it back as the background for the current element. Because this requires the browser to constantly recalculate the blur whenever a background element moves or scrolls, overusing it on large areas can cause severe battery drain and dropped frames on mobile devices.
A common bug occurs when a backdrop-filter mysteriously stops working.
This usually happens because a parent element created a new Stacking Context (e.g., by having opacity: 0.99 or transform: scale(1)). The backdrop filter can only blur elements within its current stacking context; it cannot "see" elements further down the DOM tree if an impenetrable stacking layer isolates them.
What is the CSS difference between 'filter' and 'backdrop-filter'?