JSFiddle - React, Tailwind, and code Playground

HTML

<div class="whatever">
  <p>Some Text</p>
</div>

CSS

.whatever {
  position: relative;
  width: 200px;
  height: 200px;
  background: url(https://images.pexels.com/photos/415380/pexels-photo-415380.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb) center center no-repeat;
  background-size: cover;
  font-size: 24px;
  color: white;
  text-align: center;
}

.whatever:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  transition: all .2s linear;
}

.whatever:hover:before {
  background: rgba(0, 0, 0, .4);
}

p {
  position: relative;
  z-index: 2;
}