JSFiddle - React, Tailwind, and code Playground

HTML

<div id="d1">
    <div id="d2">W
        <br>o
        <br>r
        <br>l
        <br>d
    </div>
    <div id="d3">Hi</div>
</div>

CSS

#d1 {
    background-color:yellow;
    position:relative;
}
#d2, #d3 {
    position:absolute;
}

JavaScript

var  d2Height = $("#d2").height(),
     d3Height = $("#d3").height(),
     largest = Math.max(d2Height, d3Height);
alert(largest);
console.log($("#d1").height());
  $('#d1').css({"height":largest});
console.log($("#d1").height());