Lurker News
There are lots of glassmorphism generators out there, but I wanted to push the effect further! This project is the result of months of experimenting with CSS property layering and battling browser quirks.

Cross-browser compatibility is actually the reason I rely on ::before and ::after pseudo-elements to build up the effect. Move the color/opacity to the main element, and you’ll get weird color bleed on the corners in Chrome. Move the texture, and it muddles the bevel’s specular highlight. Move the bevel, and it gets blurred out by the backdrop-filter. And so on!
Layers include: * Adjustable blur, brightness, and saturation (backdrop-filter) * Subtle translucent texture * Faux 3D bevel (using box-shadows, not an outline)
Glassmorphism is rather heavy on resources, so it’s best used as an accent and avoided on wide desktop elements. Should be compatible with recent versions of Chrome, Safari, and Firefox (desktop and mobile). If you spot bugs or rendering glitches, I’d love to know!
Side note: this is an early preview of a framework-agnostic glass SCSS/component library I’m building.

Comments (117) 32 threads

Show all comments

Showing thread 18 of 32

alberth2 replies#
I'd be concerned about the maintenance overhead of this ~44-lines of code vs. just 1-line of code that has a similar (while slightly less realistic) net effect:

  filter: blur(16px);
andrewingram2 replies#
I’m curious why. I’d have concerns about the performance of this effect, but 44 lines of CSS to achieve a higher level of polish and, dare I say, craft, doesn’t seem like something to be dismissive of at review stage.
alberth#
The OP uses this same blur + a lot more effect (to make it look more realistic).

So it'd actually be the OP CSS that would perform worse than this single line.

kris-kay#
Thanks for stating my side of this trade-off and for the nice feedback!
ivape#
I have AI that can do just about everything for me, but I still need to make this tradeoff with CSS in 2025?