Inset Reveal

A dark overlay covers the image at idle, then shrinks inward from each edge on hover/focus, revealing a centered window of the image.

Inset Reveal demo

Hover or focus the image to see the effect.

HTML

description

CSS

.hover-effect.inset-reveal{
  position: relative;
  display: block;
}
.hover-effect.inset-reveal::before{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  clip-path: inset(0);
  transition: clip-path 0.5s ease;
  pointer-events: none;
}
.hover-effect.inset-reveal:hover::before,
.hover-effect.inset-reveal:focus-visible::before{
  clip-path: inset(40%);
}

The ::before shrinks from clip-path: inset(0) to inset(40%) on hover/focus, revealing a centered window of the image. Select the code and copy with Ctrl+C or ⌘C.