JSFiddle - React, Tailwind, and code Playground
by ppgab
HTML
<a href="#myModal">
Open Modal
</a>
<div id="myModal" class="modal">
<div class="modal-body">
Hello I'm a modal
<a href="#" class="float-right">×</a>
</div>
</div>
CSS
.modal::before {
position: absolute;
height: 100%;
width: 100%;
opacity: 0.5;
background: black;
content: '';
z-index: 1055;
}
.modal {
display: none;
opacity: 0;
position: absolute;
height: 100vh;
width: 100vw;
top: 0;
left: 0;
justify-content: center;
align-items: center;
}
.modal:target {
display: flex;
opacity: 1;
transition: ease 1s opacity;
}
.modal-body {
background: white;
z-index: 1056;
padding: 1rem;
}
.float-right {
float: right;
}