0

How can the width and size of the added new divs be set in cm?

e.g. width:10cm; the value that appears on each computer changes and it does not exactly match when measured with a ruler. I guess because of the resolution.

I want to reach the same result by measuring the div on the screen with the ruler.

How can I do this calculation?

Sema
  • 21
  • 3
  • To achieve this you would need to know the DPI setting of the client machine, which JS cannot get access to. Why do you need this? – Rory McCrossan Feb 23 '17 at 12:03
  • I want to create a label. The output on the paper should be according to the actual cm. I need to arrange it on the computer before I get it. – Sema Feb 23 '17 at 12:07
  • 1
    So it's the print size that should be accurate not the screen size? Doesn't `width:10cm` give accurate print size? – James Feb 23 '17 at 12:08
  • 1
    Sites like iruler.net has done it. You just need to know/guess some specs of your clients monitor. [See here](http://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window) – Fredrik Schön Feb 23 '17 at 12:08
  • You should check this article: https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/ – metalcamp Feb 23 '17 at 12:09
  • No, the print size varies according to the label type. – Sema Feb 23 '17 at 12:11

0 Answers0