Forum How do I...?

font-size differs in browser and the PDF

I use to define font-sizes in pixels. I get a feeling that, font-size of the browser and font-size of the PDF generated in Prince have a difference. Is that true? If so, what unit should I use instead of pixels, so that I can get the exact font-size in all browsers and in the PDF generated using Prince?

Thank you,
Jeffrin
mikeday
The same size relative to what?
Come on!!

Let me tell an example:

I have a text inside div with css font-size:12px; assume I have defined them in a html file. If I run the html in browser, chrome and firefox display the text as 12px. But I get a feeling that, when I run the same html in prince and generate a PDF, the font-size of 12px appears to be larger.
Here I have attached to screen shots. Please have a look at them. One screen shot is of chrome. And another one is of PDF generated using prince.

<html><head></head><body>
	<div style="width:100px;height:100px;font-size:15px;background-color:yellow;">Here are the texts that wraps differently in browsers and in PDF.</div>
</body></html>

  1. Screenshot from 2018-02-22 10-28-36.png143.1 kB
  2. Screenshot from 2018-02-22 10-29-21.png151.4 kB

Edited by Jeffrin Manova Prabahar

mikeday
When I run it here the text overflows in Firefox, does not overflow in Chrome, and does not overflow in Prince; it depends what is the default serif font being used.