Gallery · 03 of 33

Curtain Reveal

Overlay slides away

HTML · CSS · No dependencies · MIT

HTML

<div class="curtain-reveal">
  <img src="https://picsum.photos/id/15/800/600" alt="Waterfall">
  <div class="curtain"></div>
</div>

CSS

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

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

.curtain-reveal .curtain {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #0a0a0f;
  opacity: 0.8;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.curtain-reveal:hover .curtain {
  transform: scaleY(1);
}