Loading video...
Video Failed to Load
CSS Trick! ⚡️ You can create gradient borders by using transparent borders 👀 No extra elements 🤙 article { background: // layer them up with different origin! linear-gradient(var(--bg), var(--bg)) padding-box, var(--gradient) border-box; border: 4px solid transparent; } The trick is to layer background images using different background-origin ⭐️ Then... show more
646,445 views • 2 years ago •via X (Twitter)
10 Comments

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

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 😎

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 😄

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 🤩

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 😅

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

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 -

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.

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

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!
