I have a <p> inside a <div> that I set the following properties for:
div { height: 105px; width: 60px; overflow: hidden; }
If the <p> contains a lot of text, some of them will be truncated.
My goal is to find that the first word is not displayed.
For example, in the following scenario:
div { height: 105px; width: 60px; overflow: hidden; }
<div> <p>People assume I'm a boiler ready to explode, but I actually have very low blood pressure, which is shocking to people.</p> </div>
the function will return the word "explode".
I know from this question that it is quite easy to detect if there is an overflow, but can we take this step further and determine which word is the first to be hidden?
javascript html css
Markscode
source share