Загрузка видео...

Не удалось загрузить видео

На главную

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

188,112 просмотров • 3 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля Geoffrey Shepard
Geoffrey Shepard3 лет назад

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

Фото профиля Wes Bos
Wes Bos3 лет назад

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

Фото профиля John Hooks
John Hooks3 лет назад

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

Фото профиля Wei Su
Wei Su3 лет назад

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

Фото профиля Karol Głomski ⌨ 🐍
Karol Głomski ⌨ 🐍3 лет назад

how do I save a tweet for later?

Фото профиля Hagai Bloch
Hagai Bloch3 лет назад

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

Фото профиля Lucas Nunes | Lukinh4Z
Lucas Nunes | Lukinh4Z3 лет назад

@Reimanzzzzzzzz

Фото профиля Tyler Freedman
Tyler Freedman3 лет назад

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

Фото профиля Wes Bos
Wes Bos3 лет назад

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

Фото профиля Odii
Odii3 лет назад

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

Похожие видео

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 просмотров • 2 лет назад