JSFiddle - React, Tailwind, and code Playground
HTML
<div class="frame">
<p>some text some text some text some text</p>
</div>
CSS
.frame {
width: 120px;
display: none;
}
.offscreen {
position: fixed !important;
left: -9999px !important;
display: inline !important;
}
JavaScript
$('.frame').addClass('offscreen');
alert('The hieght of \'p\' is: ' + $('p').height() + 'px');
$('.frame').removeClass('offscreen');