Inset Frame

An inset colored border appears on hover/focus, sitting inside the image bounds like a thin halo.

Inset Frame demo

Hover or focus the image to see the effect.

HTML

description

CSS

.hover-effect.inset-frame{
  position: relative;
  display: block;
}
.hover-effect.inset-frame::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0 #2563eb;
  transition: box-shadow 0.4s ease;
}
.hover-effect.inset-frame:hover::before,
.hover-effect.inset-frame:focus-visible::before{
  box-shadow: inset 0 0 0 6px #2563eb;
}

The ::before uses an inset box-shadow that animates from 0 to 6px on hover/focus, creating a colored inset halo. Select the code and copy with Ctrl+C or ⌘C.