Slide Cover Top

Cover anchored to the top edge grows from zero to full height on hover, covering the image from top to bottom.

Slide Cover Top demo

Hover or focus the image to see the effect.

HTML

<div class="hover-effect slide-cover-top">
  <img src="image.jpg" alt="description">
</div>

CSS

.hover-effect.slide-cover-top{
  position: relative;
}
.hover-effect.slide-cover-top::before{
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  background: #1a1a1a;
  transition: height 0.5s ease;
}
.hover-effect.slide-cover-top:hover::before,
.hover-effect.slide-cover-top:focus-visible::before{
  height: 100%;
}
@media (prefers-reduced-motion: reduce) {
  .hover-effect.slide-cover-top::before{
    transition: none;
  }
  .hover-effect.slide-cover-top:hover::before,
  .hover-effect.slide-cover-top:focus-visible::before{
    height: 100%;
  }
}

The cover pseudo is anchored to the top edge and its height grows from zero to full on hover. Select the code and copy with Ctrl+C or ⌘C.