Snippet / Theme Options > Custom CSS with a custom wrapper class

Image Hover Overlay

Adds a dark overlay, centered text, and a subtle image zoom for portfolio cards and gallery links.

Use a Code module or Theme Builder card wrapper with this structure, then adapt the image and label.

<a class="dfy-image-overlay" href="/portfolio/example/">
  <img src="/path/to/image.jpg" alt="Project name">
  <span>View Project</span>
</a>
.dfy-image-overlay {
  position: relative;
  display: block;
  overflow: hidden;
  color: #ffffff;
  text-decoration: none;
}

.dfy-image-overlay img {
  display: block;
  width: 100%;
  transition: transform 260ms ease;
}

.dfy-image-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.56);
  opacity: 0;
  transition: opacity 220ms ease;
}

.dfy-image-overlay span {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 18px;
  font-weight: 800;
  opacity: 0;
  transition: opacity 220ms ease;
}

.dfy-image-overlay:hover img,
.dfy-image-overlay:focus-visible img {
  transform: scale(1.06);
}

.dfy-image-overlay:hover::before,
.dfy-image-overlay:hover span,
.dfy-image-overlay:focus-visible::before,
.dfy-image-overlay:focus-visible span {
  opacity: 1;
}

Notes

  • Make the whole card a link if the overlay text is a call to action.
  • Keep contrast strong enough for the overlay label to remain readable.

Sources