Gallery · 17 of 33

Pixelate

Steps down resolution (CSS filter)

HTML · CSS · No dependencies · MIT

HTML

<div class="pixelate">
  <img src="https://picsum.photos/id/106/800/600" alt="Flower">
</div>

CSS

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

.pixelate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
  filter: contrast(1.2) blur(4px);
  transition: filter 0.4s ease;
}

.pixelate:hover img {
  filter: contrast(1) blur(0);
}