CSS Trick! ⚡️ You can create gradient borders by using transparent borders 👀 No extra elements 🤙…
@jh3yy148K followers
647,526 views
10 Comments
Comments from the original post on X (Twitter)

@jh3yy
If you want a better video of that exploding view breaking things down 👇 Got a bit better contrast on the background 😅
29 likes

@jh3yy
Here's that @CodePen link! 🚀 Have a play with different gradients and properties 🤙 When the Properties and Values API lands in all browsers properly, we'll be able to animate the gradients on :hover, etc. too 😎
35 likes

@thomasglopes
Awesome! I recently created a utility for when you want to combine and use multiple gradients in the border: Used a variant of it for Appwrite's website 😄
20 likes

@jh3yy
Ya love to see it! 🤙 Great stuff. That button looks dope too 👏 New Appwrite theme color is fire by the way. Very much what I'm into 🤩
2 likes

@delba_oliveira
Next challenge: support background transparency so we can use backdrop-filter blur. It's a nice effect when items overlap e.g. our diagrams here: I have spent an unreasonable amount of time trying to find a nice simple pattern 😅
10 likes

@jh3yy
There's gotta be a nice masking solution for this 💯 I'll have a play! 🤙 Those docs do look good 🖤🤩
4 likes

@techniq35
I use this same technique for a spotlight effect (which I believe I saw a codepen of yours use as well). It's available as a nice Svelte action as well -
6 likes

@dannievinther
An awesome technique. The effect needs both background-origin and background-clip to work. Luckily, when providing a single value it resolves to both origin and clip.
5 likes

@jh3yy
Yes – Good point Dannie 🤙 I didn't make that clear. Thanks for pointing it out 🙏
2 likes

@simonswiss
Omg man I went down this *exact* rabbit hole 2 weeks ago and refactored dozens of hacky, multi-layer elements to this padding-box/border-box linear gradient. So satisfying to simplify the HTML!
4 likes