JSFiddle - React, Tailwind, and code Playground
HTML
<div class="col-md-4 text-center img-1">
<div class="img-wrap">
<img src="http://placehold.it/150x150" />
</div>
</div>
<div class="col-md-4 text-center img-1">
<div class="img-wrap2">
<img src="http://placehold.it/150x150" />
</div>
</div>
CSS
.img-wrap {
width: 150px;
height: 150px;
position: relative;
}
.img-wrap:after {
display: none;
content: '';
background: red;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 3;
}
.img-wrap:hover:after {
display: block;
}
/* - */
.img-wrap2 {
width: 150px;
height: 150px;
position: relative;
}
.img-wrap2:after {
opacity: 0;
content: '';
background: red;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 3;
-moz-transition: 0.4s ease;
-webkit-transition: 0.4s ease;
transition: 0.4s ease;
}
.img-wrap2:hover:after {
opacity: 1;
}