JSFiddle - React, Tailwind, and code Playground

by Nikki Rabbitt

HTML

<div id="web_view_container">    
    <span class="sentences">Hello, this is last sentence this is last sentence this is last sentence this is last sentence this is last sentence.</span>
</div>
<p class="lines"></p>

CSS

#web_view_container
	{
		position:absolute;
		top:100px;
		left:100px;
		width:306px;
		height:202px;
		overflow:auto;	
	}
	.sentences
	{
		font-family:Georgia, "Times New Roman", Times, serif;
		font-size:20px;
	}

JavaScript

var $sent = $('.sentences'),
    lh = $sent.css('line-height'),
    ws = $sent.css('white-space');
if (lh === 'normal') {
    $sent.css('white-space', 'nowrap');
    lh = $sent.height();
    $sent.css('white-space', ws);
}
$('.lines').text(Math.ceil($('.sentences').height() / parseInt(lh, 10)));