Open any border, copy the HTML and CSS, and put your own content inside the box. The border is drawn with a pseudo-element, a background-clip layer or a mask, so it never changes the box's size or shifts the layout while it animates.
To change the color, set --bdr-color; gradients and glows are mixed from it. To change the size, set --bdr-size: the border width, radius and glow are in em.
Rotating gradient borders animate a registered @property angle, which every current browser supports; older ones show a still gradient border. Every snippet ships with a prefers-reduced-motion rule that stops the motion.
A border itself can't hold a gradient or move. Draw it with a pseudo-element or a background-clip: border-box layer, then animate its transform, background-position or an @property angle.
Use two backgrounds with a transparent border: a solid fill clipped to padding-box and the gradient clipped to border-box. For a see-through middle, mask the inside with mask-composite: exclude.
Register an angle with @property, use it as the start of a conic-gradient, and animate it from 0deg to 360deg. The rotating entries above are complete.
Stack box-shadow layers in the accent color for an outer glow and add an inset shadow for an inner glow. Use filter: drop-shadow() for shapes that aren't rectangles.
Yes. It has been supported everywhere since Firefox 128 shipped it in mid 2024. Older browsers ignore the animation and show a static gradient border.