JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="inner"></div>
</div>
CSS
.container{
position:fixed;
width:100px;
height:100px;
top:0;
right:0;
bottom:0;
left:0;
margin:auto;
background:green;
padding:10px;
}
.inner{
width:200px;
height:150px;
background:red;
}
JavaScript
$(document).ready(function() {
var inner_width = $('.inner').width();
var inner_height = $('.inner').height();
$('.container').width(inner_width);
$('.container').height(inner_height);
});