<div class="card">
  <img class="card__img" src="https://img.7ya.ru/pub/img/24226/depositphotos_79278492_m-2015.jpg" alt="">
  <div class="card__overlay">Любой контент</div>
</div>
.card {
  position: relative;
  display: inline-flex;
}

.card:hover .card__overlay {
  opacity: 1;
  visibility: visible;
}

.card__img {
  width: 400px;
  height: auto;
}

.card__overlay {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 48px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: 0.35s;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.