JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent">
    <div class="child">fdsfdsf</div>
</div>

CSS

body, html {height: 100%}
.parent {
    height: 100%;
    width: 960px;
    background:Red;
}
.child {
    margin:auto auto;
    background:green;
    width: 50%;
}

JavaScript

function resizeChild(){
    var child = $(".child");
var parentSize = child.parent().height();
child.height(parentSize/2);
    child.width(parentSize/2);
}
$(window).ready(resizeChild);