Gallery · 26 of 33

Halftone Pattern

Dot pattern overlay on hover

HTML · CSS · No dependencies · MIT

HTML

<div class="halftone">
  <img src="https://picsum.photos/id/177/800/600" alt="Halftone">
</div>

CSS

.halftone {
  position: relative;
  width: 400px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
}

.halftone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A repeating radial gradient produces the dot grid */
.halftone::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle, #000 2px, transparent 2.5px);
  background-size: 8px 8px;
  opacity: 0;
  transition: opacity 0.4s;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.halftone:hover::after {
  opacity: 0.4;
}