Menu

Animated gradient borders with CSS only
📰

Animated gradient borders with CSS only

Reddit r/webdev·u/Blozz12·7 months ago
#frIAn6Fi
#gradient#animated#border#effect#article
Reading 0:00
15s threshold

I’ve always liked those glowing animated border effects you see on fancy landing pages.

But for a long time, I avoided them because they often felt a bit too hacky. Either you had to stack weird extra markup, use SVG tricks, or reach for JavaScript just to make a gradient move.

So I tried rebuilding the effect with modern CSS only.

The final version uses:

a pseudo-element for the border layer

a conic-gradient() for the colors

@ property to make the angle animatable

a second blurred layer for the glow

and a prefers-reduced-motion fallback so it does not force animation on everyone

What I like about this approach is that the HTML stays almost boring. Just a card. All the visual work happens in CSS.

Not claiming this is something you should put everywhere. It can get visually loud pretty fast.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.