Please see the comment to the question, Richard's and mine. You cannot reliably estimate this value. So, you can use the alternative I suggested: use JavaScript in the client side. The function you may need is this:
HTMLElement.offsetHeight — Web APIs | MDN[
^].
Don't be confused with the name of this function, just use it to determine the actually rendered height of some element. There is a big catch: read the note about "including vertical padding and borders". It can be a big complication, because the code calling this function should better be agnostics of the style used. I usually used the following technique: I applied my calculations to some parent element (such as
div
) which I styled to have zero borders, padding and margins, specially for this purpose. The rendering gave a required room for the content of this element, which I could measure using this function.
Just in case, this is how you can read all the style metrics for some already rendered styles:
Window.getComputedStyle() — Web APIs | MDN[
^].
Anyway, this is the technique which really works; and I'm sure that any attempts to do such calculations on the server side would be just hopeless.
—SA