Development · Tip
CSS Frosted + Saturated Borders
CSS technique for dynamic, semi-transparent borders using background-clip and backdrop-filter
This technique combines background-clip and backdrop-filter to create borders that frost and saturate background colors passing behind an element. It replaces rigid solid borders with a softer glassmorphic edge that picks up underlying content shadows and colors.
How it works
Technique by @jh3yy: frosted + saturated borders using background-clip + backdrop-filter. Video demos a card ('Add to cart', price €17,95 with €3,95 struck through) whose border frosts and saturates whatever colors scroll beneath it.
Key ideas from the thread:
- Use background-clip + backdrop-filter to create a frosted, saturated border that lets color/shadows through.
- Adding some opacity on the border lets color/shadows through — solid borders can feel a little "harsh"; it can be subtle.
- Alternative implementations: "border + background-clip" (used in the demo), or "outline", layered backgrounds, or a pseudo-element underlay with negative inset if you want gradients.
- jhey often prefers the pseudo-element route so a subtle gradient doesn't disrupt layout; choice depends on scenario and constraints.
CodePen (adjustable saturation, blur, etc.): https://codepen.io/jh3y/pen/jEWRjQL
Related post referenced: https://x.com/steveschoger/status/1695139153753604384
What it's for
- Style card borders that blend subtly into colorful or shifting backgrounds
- Create dynamic glassmorphic UI elements without heavy graphics
- Soften harsh component outlines using semi-transparent, color-reactive borders
Key points
- Uses background-clip paired with backdrop-filter to isolate filter effects to the border area
- Enhances underlying background tones using saturation and blur adjustments
- Alternative implementation using pseudo-elements with negative insets for gradient borders without layout shift
- Can be adapted using border, outline, or layered background approaches depending on design constraints
Pricing
Free
Details
- Type
- Tip
- Category
- Development
- Topic
- CSS Tricks
- Platforms
- Web
- For
- Front-end developers and UI designers
- Tags
- css, web design, backdrop filter, glassmorphism, ui
Why it was saved
- @jh3yy: Reusable trick for softer, more interesting borders than solid ones
Related
React component library for Apple-style liquid glass and blur effects.
Visual generator for creating organic blob shapes using CSS border-radius
Lightweight, modular JavaScript animation engine for CSS, SVG, and DOM elements
Modern CSS technique for smooth height transitions without fixed pixel heights
CSS recipe for interactive 3D card tilt and 2D layer parallax
CSS pattern for switching colors across themes without duplicate selectors
Updated