Range.getClientRects()returns a ClientRectbusy list , rangeand this works well when the range is within the normal range that the text has.
<div class="line">
<span class="run">Hello!</span><span class="run"></span>
</div>
But it does not receive ClientRectwhen the pool is empty. (as in the second flight)
I tried the following, but the results were unsatisfactory.
- Set the span property value for
inline-block - Paste
'\ufeff'into the span. In this case, I can get ClientRect, but it will ruin the rest of the code.
If I can calculate the row height from font-size, it would be better. Is there a way to get the row height of an empty spacing in px?
NOTE. I am not trying to get the line-heightcss property . In this case there line-heightwill be normal.
source
share