JSFiddle - React, Tailwind, and code Playground
HTML
<div class="imageContainer">
<div class="overlay">
<div class="overlayText">blahblahblah
<br/>some Text</div>
</div>
<img src="http://lorempixel.com/400/400/">
</div>
SCSS
/* centering stuff */
.imageContainer{
position: relative;
display: inline-block;
}
.overlayText{
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
position: relative;
text-align: center;
}
.overlay{
position: absolute;
width: 100%;
height: 100%;
}
/* styling stuff */
.overlayText{
width: 80%;
background-color: rgba(0,0,0,0.4);
padding: 10px;
font-size: 20px;
}
.imageContainer{
font-size: 0;
}
.overlay{
display:none;
color: white;
background-color: rgba(0,0,0,0.4);
}
.imageContainer:hover #overlay{
display: inline-block;
}
img{
width: 150px;
}