Home html5 Recalculation MM in pixels

Recalculation MM in pixels

Author

Date

Category

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;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions