I have a <p>
tag inside a <div>
which I've set the following properties on:
div {
height: 105px;
width: 60px;
overflow: hidden;
}
If the <p>
tag contains a lot of text then some of it will be cut off.
My goal is to detect what the first word not being shown is.
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 would return the word "explode".
I know from this question that it is quite easy to detect if there's an overflow, but can we take this one step further and detect which word is the first to be hidden?