JSFiddle - React, Tailwind, and code Playground

by t2t2

HTML

<div class="item">
  <img src="http://placekitten.com/400/600" alt="">
  <div class="overlay">
    <p>Text text text</p>
  </div>
</div>

CSS

.item {
  position: relative;
  width: 400px;
  height: 600px;
}

.item .overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.5s;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
}

.item:hover .overlay {
  opacity: 1;
}