JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#">click for fun</a>

CSS

body, html {
    height: 100%;
}
div#shadow {
    position: fixed;
    top:0;
    left:0;
    bottom:0;
    right: 0;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}

div#fancybox {
    position: absolute;
    width: 400px;
    height: 400px;
    left: 50%;
    top: 50px;
    margin: 0 0 0 -200px;
    background: #ddd;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    border: 3px solid #fff;
}

JavaScript

$('a').click(function(){
    var that = $(this)
    var html= that.text()
    $('body').append('<div id="shadow"><div id="fancybox">' + html +'</div></div>')
        $('#shadow').click(function(){
            $(this).remove()
        })
})