Gallery · 02 of 33

Grayscale → Color

Fade in color on interaction

HTML · CSS · No dependencies · MIT

HTML

<div class="gray-color">
  <img src="https://picsum.photos/id/12/800/600" alt="Beach">
</div>

CSS

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

.gray-color img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.5s ease;
}

.gray-color:hover img {
  filter: grayscale(0%);
}