Glass effect on a website: glassmorphism and Liquid Glass with CSS
How to build a glass panel in CSS: backdrop-filter, edge highlight, shadow and grain. When the glass effect works and when it hurts readability.

Glass interfaces are back: a translucent panel, blur of whatever is behind it and a neat light on the edge. A basic version takes a dozen lines of CSS.
The base: backdrop-filter
.glass {
background: rgba(255, 255, 255, .12);
backdrop-filter: blur(20px) saturate(140%);
-webkit-backdrop-filter: blur(20px) saturate(140%);
border-radius: 24px;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2),
0 24px 48px rgba(0, 0, 0, .25);
}backdrop-filter blurs everything under the element. The -webkit- prefix is for Safari. The inset shadow gives a thin light edge, the outer one gives depth.

Premium glass vs cheap glass
- Light: a gradient highlight on the top edge, not a flat white border.
- Grain: a little noise removes the plastic look of blur.
- Reaction: the highlight follows the cursor slightly.
- Contrast: text on glass must read on any background.
When not to use glass
Over a flat background there is nothing to blur, so the effect is invisible. Glass shines over photos, video and animated backgrounds. Avoid long text on glass.
Performance
Blur is expensive for the browser. Do not stack dozens of glass elements on one screen and do not animate the blur amount. Moving the panel with transform is fine.

Ready glass menus, sidebars and cards are in the catalog, with light, grain and cursor reaction and no extra libraries.




