JSFiddle - React, Tailwind, and code Playground

by 64kps

HTML

<div id="hello">hello hello hello hello hello hello hello</div>
<div id="donut">donut</div>

CSS

#hello {
    background-color: yellow;
    font-size: 60px;
}

#donut {
    background-color: red;
}

JavaScript

var hello = document.querySelector('#hello');
var donut= document.querySelector('#donut');

var resize = function (event) {
    var helloHeight = window.getComputedStyle(hello).height
    helloHeight = helloHeight.replace('px', '');
    helloHeight = parseFloat(helloHeight);

    donut.style.height = (window.innerHeight - helloHeight) + 'px';
};

window.addEventListener('resize', resize, false);
resize();