JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container-popup"></div>
<div class="popup">
<span id="close">X</span>
</div>
CSS
html {
background: url(http://lorempixel.com/400/400) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.container-popup {
position: relative;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,.8);
z-index: -1;
}
.popup {
display:inline-block;
background: #FFFF;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
z-index: 1;
}
span{
float: right;
padding: 3px 6px;
background-color: red;
border-radius: 40px;
cursor: pointer;
}
JavaScript
$(document).ready(function(){
$(".container-popup, #close").click(function(){
$('.popup').hide(); $('.container-popup').hide();
});
});