JSFiddle - React, Tailwind, and code Playground
by Alexander Startsev
HTML
<div class="image">
<img src="http://loremflickr.com/372/372" alt="">
<div class="overlay"><span>Hover me!</span></div>
<div class="overlay second"><span>And me too</span></div>
<div class="overlay third"><span>Let's do it again</span></div>
<div class="overlay fourth"><span>And again</span></div>
</div>
CSS
html, body{
margin: 0;
padding: 0;
}
.image{
overflow: hidden;
display: inline-block;
position: relative;
margin: 10px;
}
.overlay{
position: absolute;
overflow: hidden;
left: 20px;
top: 20px;
color: #FFF;
font: 300 14px/20px Helvetica, Arial, sans-serif;
text-align: center;
width: 154px;
height: 154px;
border: 1px #DDD dashed;
cursor: default;
line-height: 150px;
border-radius: 5px;
-webkit-transition: .15s box-shadow;
-o-transition: .15s box-shadow;
transition: .15s box-shadow;
}
.overlay span{
display: inline-block;
max-width: 110px;
vertical-align: middle;
line-height: normal;
padding: 5px 10px;
background-color: rgba(0,0,0,.6);
border-radius: 5px;
-webkit-transition: 2s opacity;
-o-transition: .2s opacity;
transition: .2s opacity;
}
.overlay:hover{
width: 150px;
height: 150px;
border: 3px yellow solid;
box-shadow: 0 0 8px 2px rgba(0,0,0,.6);
}
.overlay:hover span{
opacity: 0;
-webkit-transition: 0s opacity;
-o-transition: 0s opacity;
transition: 0s opacity;
}
.overlay:hover:before{
content: '';
position: absolute;
width: 100px;
height: 100px;
left: 50%;
top: 50%;
margin-left: -130px;
margin-top: -130px;
background: transparent;
border-radius: 50%;
border: 80px rgba(0,0,0,.6) solid;
}
.overlay:hover:after{
content: '';
position: absolute;
width: 94px;
height: 94px;
left: 50%;
top: 50%;
margin-left: -50px;
margin-top: -50px;
border: 3px yellow solid;
border-radius: 50px;
}
.overlay.second{
left: 196px;
top: 20px;
}
.overlay.third{
left: 20px;
top: 196px;
}
.overlay.fourth{
left: 196px;
top: 196px;
}