JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrap">
<a href="#" class="link">Open</a>
<a href="#" class="close">Close_OFF</a>
<div class="popup-wrapp"></div>
<div class="myblok">
</div>
</div>
CSS
* {
margin: 0;
padding: 0;
}
html,body {
width: 100%;
height: 100%;
background-color: #cccccc;
}
.wrap {
width: 800px;
height: 100%;
margin: 0 auto;
overflow: hidden;
background-color: #313131;
}
.close,
.link {
background-color: #fa9100;
border-radius: 10px;
color: #fff;
display: block;
font: italic bold 16px "Arial";
width: 100px;
height: 30px;
text-align: center;
text-decoration: none;
padding-top: 10px;
margin-bottom: 10px !important;
margin: 0 auto;
position: relative;
top: 55px;
}
.link:hover {
background-color:#D9D900;
}
.popup-wrapp{
position:fixed;
z-index: 10;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: #000;
display: none;
}
.myblok {
width: 150px;
height: 150px;
background-color: #22FF00;
margin: 0 auto;
position: absolute;
clear: both;
top: 100px;
left: 50%;
top: 50%;
margin-top: -75px;
margin-left: -75px;
z-index: 999;
display: none;
}
JavaScript
$(document).ready(function(){
$('.link').on('click',function(){
$('.popup-wrapp,.myblok').fadeIn(300);
});
$('.popup-wrapp').on('click',function(){
$('.popup-wrapp,.myblok').fadeOut(300);
});
});