JSFiddle - React, Tailwind, and code Playground
HTML
<div class="outer">
<img src="http://placekitten.com/g/200/300" />
<div class="overlay">
<p class="text">x</p>
</div>
</div>
CSS
.outer {
position:relative;
width: 200px;
height: 300px;
}
.overlay {
display: block;
position: absolute;
width: 100%;
height: 100%;
background: black;
opacity: 0.7;
top: 0;
}
.outer:hover .overlay {
display: block;
position: absolute;
width: 100%;
height: 100%;
background: black;
opacity: 0.7;
top: 0;
}
.text {
position: absolute;
top: 50%;
left: 50%;
transform:translate(-50%, -50%);
color:white;
}