JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
  <img class="image" src="https://picsum.photos/200" />
  <div class="overlay">
    Overlay content here
  </div>
</div>

CSS

.container {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.image {
  display: block;
}

.overlay {
  background-color: #000000ff;
  color: white;
  opacity: 0;
  transition: opacity 120ms;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  
  /* 텍스트 가운데 정렬 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay:hover {
  opacity: 0.7;
}