JSFiddle - React, Tailwind, and code Playground
HTML
<span id="foo">
<span class="popup"></span>
</span>
CSS
#foo {
cursor: pointer;
display: block;
margin-bottom: 5px;
position: relative;
width: 200px;
height: 200px;
background:red;
}
#foo:before,
#foo:after {
content: '';
opacity: 0;
-webkit-transition: opacity .4s ease-in-out;
-moz-transition: opacity .4s ease-in-out;
-o-transition: opacity .4s ease-in-out;
transition: opacity .4s ease-in-out;
}
#foo .popup,
#foo:before {
background: #000;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5);
display: block;
height: 100%;
left: 0;
filter: alpha(opacity=0);
opacity: 0;
position: absolute;
text-indent: -9999px;
top: 0;
width: 100%;
-webkit-transition: opacity .4s ease-in-out;
-moz-transition: opacity .4s ease-in-out;
-o-transition: opacity .4s ease-in-out;
transition: opacity .4s ease-in-out;
}
#foo:after {
background: url("http://png.findicons.com/files/icons/573/must_have/48/search.png") no-repeat;
content: '';
display: block;
position: absolute;
height: 58px;
margin: -29px 0 0 -29px;
left: 50%;
top: 50%;
width: 58px;
}
#foo:hover .popup,
#foo:hover:before,
#foo:hover:after {
filter: alpha(opacity=40);
opacity: 1;
}