CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and…
@jh3yy149K followers
270,066 views
11 Comments
Comments from the original post on X (Twitter)

@jh3yy
Here's that @CodePen link! 🤙 Should work fine across the board. Tried it out in Chrome, Firefox, and Safari ⭐️ ʕ – ᴥ – ʔ
81 likes

@anatudor
"Using intersect means that the parts that overlap get replaced." That's actually incorrect. `intersect` means the alphas get multiplied where they intersect. I explained it here in detail a few years back In this case, in the padding area, it's 0*1 = 0.
7 likes

@alemalohe
That's cool, but can you do this?
6 likes

@jh3yy
Yes. Yes I can.
5 likes

@silaspath
incredible. your comprehensive deconstruction is legendary. this is pushing dev forward.
2 likes

@NicholasRyanH
Did you ever release a solution to have an *animated* gradient border with translucent elements? I think a while back you said that was coming, but I never saw it drop!
2 likes

@jh3yy
this technique right here can handle that 🤙 then you can animate the border with a conic-gradient or using offset-path depending on the type of effect you're looking for ✅ not sure if posted, but definitely spoke about it at Config
2 likes

@erikras
Dude.
1 like

@perezcarreno
These demos are awesome, @jh3yy , keep pushing the limits!
1 like

@Pentagear
Can I Use is saying mask-composite isn't supported?
1 like

@jh3yy
There's the prefixed version too 🤙 autoprefixer will convert to this 👇 -webkit-mask-composite: source-in, xor; mask-composite: intersect; It does seem to work across the board
3 likes