Loading video...

Video Failed to Load

Go Home

Really cool CSS gradient border effect I recreated after seeing it on the warp website. Demo: Code:

188,168 views • 3 years ago •via X (Twitter)

10 Comments

Geoffrey Shepard's profile picture
Geoffrey Shepard3 years ago

Woah, never seen anything like it. Cool trick, a little distracting, but has a use case somewhere

Wes Bos's profile picture
Wes Bos3 years ago

Ha def could be distracting. Use case is to make you say "Woah, never seen anything like it" 😀

John Hooks's profile picture
John Hooks3 years ago

Thanks for breaking that down. It’s a really cool effect.

Wei Su's profile picture
Wei Su3 years ago

Thank u Wes, I’m gonna steal the green one.

Karol Głomski ⌨ 🐍's profile picture
Karol Głomski ⌨ 🐍3 years ago

how do I save a tweet for later?

Hagai Bloch's profile picture
Hagai Bloch3 years ago

Damn, that's cool, now I will put it anywhere I can unnecessarily until my product manager yell at me.

Lucas Nunes | Lukinh4Z's profile picture
Lucas Nunes | Lukinh4Z3 years ago

@Reimanzzzzzzzz

Tyler Freedman's profile picture
Tyler Freedman3 years ago

Is there a way to make this effect happen in intervals by itself? I'm fairly new to CSS

Wes Bos's profile picture
Wes Bos3 years ago

Yep, you would use a setInterval to run code every 5 seconds, and each time that runs you toggle a class of “start”

Odii's profile picture
Odii3 years ago

Amazing 🔥 Trust the full version is on YouTube now, need to try this!

Related Videos

CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and mask-composite with a pseudo-element 🔥 .gradient-border::after { mask-clip: padding-box, border-box; mask-composite: intersect; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); } It's the same "Transparent border trick" from before. But, now you apply it to a pseudo-element 😎 The trick is to create a pseudo-element with a gradient background and then mask it so we only see the part we want, the border ✨ mask-clip defines the area affected by a mask. Similar to how you can define background-size. Using padding-box and border-box constrains the two masks. mask-composite is the magic part ✨ It defines a compositing operation for stacked mask layers. Using intersect means that the parts that overlap get replaced. And this seems to work in all browsers 🙌 As for the rest of the styles... – Make sure you set pointer-events: none on the pseudo-element – Make sure it fills the parent element. You can use position: absolute and inset: 0 – Make sure the background fills the space including the border-width. You can use calc to achieve that: --bg-size: calc(100% + (2px * var(--border))); background: var(--gradient) center center / var(--bg-size) var(--bg-size); That's it! 🚀 Gradient borders on translucent elements. You can set all the backdrop-filter: blur() you like! 😅 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

269,739 views • 2 years ago