Gradient Overlay

A linear-gradient overlay (transparent to dark) fades in on hover/focus, giving a cinematic vignette feel.

Gradient Overlay demo

Hover or focus the image to see the effect.

HTML

description

CSS

.hover-effect.gradient-overlay{
  position: relative;
  display: block;
}
.hover-effect.gradient-overlay::before{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.hover-effect.gradient-overlay:hover::before,
.hover-effect.gradient-overlay:focus-visible::before{
  opacity: 1;
}

The ::before fades in a top-to-bottom black gradient on hover/focus. Select the code and copy with Ctrl+C or ⌘C.