Faced such a problem – I need to set the size of the canvas 93mm x 53mm element, but the size I can only set in pixels. It turns out this task is not solving or how? Just 1mm can be a different number of pixels, depending on the permission of the monitor. Tell me, please, what should I enter this situation?
Answer 1, Authority 100%
style = "width: 93mm; height: 53mm"
Answer 2, Authority 133%
// solution is quite working on most systems.
& lt; body & gt;
& lt; div id = "ppitest" style = "width: 1in; visible: hidden; padding: 0px" & gt; & lt; / div & gt;
& lt; / body & gt;
js:
& lt; script & gt; screenppi = document.getelementbyid ('ppitest'). offsetwidth;
scrinppmm = screenppi / 25.4; // Pixel flow in one millimeter on this screen. Continue to cope?
& lt; / script & gt;