JSFiddle - React, Tailwind, and code Playground

by Paul Leech

HTML

<div class="image">
    <img src="http://placekitten.com/400/200" />
    <div class="overlay">The content of the overlay will be displayed above the img on :hover over.</div>
</div>
<div class="image">
    <img src="http://placekitten.com/250/200" />
    <div class="overlay">The content of the overlay will be displayed above the img on :hover over.</div>
</div>
<div class="image">
    <img src="http://placekitten.com/200/200" />
    <div class="overlay">The content of the overlay will be displayed above the img on :hover over.</div>
</div>
<div class="image">
    <img src="http://placekitten.com/150/300" />
    <div class="overlay">The content of the overlay will be displayed above the img on :hover over.</div>
</div>

CSS

.image {
    position:relative;
    display:inline-block;
    margin:10px;
}
.overlay {
    display:none;
}
.image:hover .overlay {
    width:100%;
    height:100%;
    background:rgba(0,0,0,.5);
    border:10px solid red;
    position:absolute;
    top:0;
    left:0;
    display:inline-block;
    -webkit-box-sizing:border-box;
    -moz-box-sizing:border-box;
    box-sizing:border-box;
    text-align:center;
    color:white;
    padding:12px;
    font-size:20px;
}
img {
    vertical-align:top;
}