JSFiddle - React, Tailwind, and code Playground

HTML

<div id='container'>
Text
<div/>

<div id='transparent'>
</div>

CSS

#transparent {
    background-color: black;
    position: absolute;
    z-index:-1;
    opacity: 0.2;
}
#container { /* These aren't needed,just here to demo */
    margin: 10px;
    padding: 20px;
    width: 400px;
    height: 200px;
    border: 1px solid black;
}

JavaScript

var c = $('#container');
$('#transparent').css({
    width: c.outerWidth(),
    height: c.outerHeight(),
    top: c.offset().top,
    left: c.offset().left
});