Forum How do I...?

The total height of multi-line text is different in PDF and browser

madaOmada
font-size: 24px;
line-height: 140%;
The real line-height is 33.6px

mikeday
Browsers differ in their line-height calculations, for example this document displays similarly in Prince and Firefox but differently in Chrome:
<style>
div {
    border: solid red thin;
    font-size: 24px;
    line-height: 140%
}

div.float {
    background: aqua;
    float: right;
    width: 2in;
    height: 302.4px
}
</style>
<div class="float">
</div>
<div>
multi<br>
line<br>
text<br>
multi<br>
line<br>
text<br>
multi<br>
line<br>
text<br>
</div>

Edited by mikeday

madaOmada
Is there any way I can solve this problem? By the way of rounding, but I don't know the difference in the way of computing the height
mikeday
In general it is difficult to get exactly matching behaviour as each browser differs, has different fonts available, rounds fractional distances differently, etc.
madaOmada
Can you just make the Google browser and prince export the same result

Edited by madaOmada

mikeday
The only way to get the exact same result as Chrome is to use Chrome, but even then it may give slightly different results on different platforms, or with different versions.