JSFiddle - React, Tailwind, and code Playground

by Thiago Diniz

HTML

<div class="modalBody">
    <div class="newsBody">
    </div>
</div>

CSS

.modalBody{
    height:100%;
    width:100%;
    background-color:rgba(0,0,0,.5);
    position:relative;
    position:fixed;    
}

.newsBody{
    top:50%;
    left:50%;
    height:450px;
    width:450px;
    transform:translate(-50%,-50%);
    background-color:#f2f2f2;
    position:absolute;
}

JavaScript

$('.newsBody').click(function(e) {
    e.stopPropagation();
});

$(document).click(function() {
    $('.modalBody').fadeOut('fast');
});