Suppose I have a div
element with height: 150px
and width:300px
. Is it possible to calculate how many lines of text can it be reside within it without overflow
, where text have predefined font-size
, line-height
and other text properties?
My Main Objective:
I have html like this:
<div id="parent">
<div>[Title]</div>
<div>[Description]</div>
<div>[Buttons]</div>
</div>
In [Description]
div
I have to display exactly eight lines of description where description comes form DB and size may be much or less. And the last lines will truncate with ...
at the end. How can I achieve my goal?
Pleas help me.