JSFiddle - React, Tailwind, and code Playground

HTML

<div id="getHeight">
</div>
<div id="yourElement">
</div>
<!-- Alot of times the html doesn't expand to the full bodys height, So i added a div called getHieght right before the body tag and gave it a position of absolute. This will ensure that it expands to 100% of the document height

CSS

html{
  min-height:500px;
}
#getHeight{
  position:absolute;
  top:0;
  left:0;
  height:100%;
  width:100%;
}
#yourElement{
  background:red;
  color:#fff;
  font-size:20px;
}

JavaScript

var bodyHeight = document.querySelector("#getHeight").offsetHeight;
//or use clientHeight if you don't car about scrollbars and borders
//Sometimes your html does not expand to the full documents height
var yourElement = document.getElementById("yourElement");
yourElement.style.height = bodyHeight + "px";
yourElement.innerHTML = "see the height of the actual document is " + bodyHeight + "px event though i gave the html a min height of 500px";