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

Earlier comments
mikedelfino2 replies#
That content scrolls quite slow on my phone. Is there another scrolling effect that makes it slower on purpose or it's a side effect of the glass look?
xgpyc2qp1 reply#
On my M4 128 Gb ram works fine
jdiff#
I would imagine a great many things work fine on any M4 that don't work fine on a great many phones and other devices.
kris-kay1 reply#
Interesting, no there are no scroll effects anywhere on the page. Would you mind sharing what device, browser, and level of internet connection you're using?
mikedelfino3 replies#
Never mind, I tried recording it now but could not reproduce it anymore. It was probably something on my phone at the time (Firefox on Android). I tried to remove or edit my previous comment but it seems it's not an option. Sorry for the noise.
kris-kay#
All good! Thanks for looking into it.
pfg_#
Firefox on Android often lags for me with backdrop blur effects
onli#
It was also quite slow for me, also with Firefox on Android.
smeej1 reply#
I might be missing something, but I think this would be a lot more useful to me on mobile if I could hide or collapse the box. Instead, it takes up the entire screen and I can't really even see the effect behind it. I'm still interested enough that I'll probably try it again later on a larger screen, but I think some kind of option to hide the box would go a long way!
kris-kay#
> this would be a lot more useful to me on mobile if I could hide or collapse the box.

Are you referring to the code preview area?
In my first implementation, I had a small demo rectangle above the generator UI, but even a small one took up too much space and made the UI harder to use. If I let the whole page scroll, people got frustrated because it wasn’t obvious they needed to stay at the top of the scroll to see the rectangle they were editing.
Since this tool is mainly intended for coding, I’m prioritizing the desktop experience, with mobile acting more as a quick preview and proof that it works on mobile. That said, if you know of any similar UI that works really well on mobile, please share links!

refulgentis2 replies#
Pro tip: Apple adds fancy GPU effects because Android can't rely on good GPUs, so Apple can continually define premium.

Thus, the odds you're doing glass-morphism via a Gaussian blur and drop shadow in CSS, are exactly 0. They are assuredly at abstraction levels far below that.
(disclaimer: worked on Pixel, did the color extraction + color system stuff for Material You)

its-summertime1 reply#
It's meant to mimic frosted glass, not Apple's liquid glass design.
kris-kay#
Yes thank you
kris-kay#
I mean you are right...but I still want to make the nicest thing I can make for the web.
tempodox1 reply#
Wow, that Video tab looks gorgeous. I still don't understand yet how it's actually done.
kris-kay1 reply#
Thanks! Do you mean how the glass or how the video background is done?
tempodox1 reply#
The background.
kris-kay1 reply#
So you need a video HTML tag with all of these attributes:

and the CSS: .bg-video { position: fixed; z-index: -1; inset: 0; width: 100%; (don't set this to 100vw or you will have scrollbar issues) height: 100%; min-height: 100vh; object-fit: cover; object-position: center; pointer-events: none; }
The part I still need to do myself is provide multiple video sizes and show the one that's most suitable for the viewport.

Continue this thread — 1 reply

Load more comments