JSFiddle - React, Tailwind, and code Playground

by igalst

HTML

<div class="overlay" id="some-window">
    <a href="#"></a><!-- This handles closing when clicking outside the popup -->
    <section>
        <a class="close" href="#">x</a>
        hi there<br>
    </section>
</div>

<a href="#some-window">open a window</a>

CSS

.overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.65);
    display: none;
}

.overlay:target {
    display: block;
}

/* This handles closing when clicking outside the popup */
.overlay > a {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    cursor: default;
}

.overlay section {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -50px;
    margin-left: -100px;
    width: 200px;
    height: 100px;
    background: blue;
    color: white;
    border: solid 5px white;
    border-radius: 20px;
    text-align: center;
}

.overlay .close {
    color: red;
    position: absolute;
    top: -5px;
    left: 5px;
    font-size: 30px;
    text-decoration: none;
}