Hover or focus the image to see the effect.
HTML
CSS
.hover-effect.animated-frame{
position: relative;
display: block;
}
.hover-effect.animated-frame::before{
content: "";
position: absolute;
inset: 0;
border-radius: 6px;
padding: 4px;
background: conic-gradient(
from 0deg,
#2563eb 0deg,
#ec4899 90deg,
#f59e0b 180deg,
#10b981 270deg,
#2563eb 360deg
);
-webkit-mask:
linear-gradient(#000 0 0) content-box,
linear-gradient(#000 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}
.hover-effect.animated-frame:hover::before,
.hover-effect.animated-frame:focus-visible::before{
opacity: 1;
animation: animated-frame-spin 1.6s linear infinite;
}
@keyframes animated-frame-spin{
to{ transform: rotate(360deg); }
}
The ::before pseudo-element uses a conic gradient masked to a 4px border ring that rotates on hover/focus. Select the code and copy with Ctrl+C or ⌘C.