Scale 'mm' to 'pixels' in CSS [duplicate]

时间秒杀一切 提交于 2019-12-13 11:23:50

问题


I have a container with every measurement defined in 'mm' for printing purposes. However, I want to show its preview inside a 600px wide block with perfect fit. What would be the best way to scale it down?


回答1:


The millimiter to pixels and vice-versa formula takes the DPI of the screen into consideration.

DPI meaning dots-per-inch.

There's no truth in mm to pixels unless you have a stable DPI value you can use.

Anyway, this is the formula:

mm = (pixels * 25.4) / dpi

The most-usual seen DPI values seen are 72 and 96 if I'm not mistaken, but since this is for print it will most likely depend on the printer settings




回答2:


I found this website that converts pixels to mm or vice versa: http://www.unitconversion.org/typography/millimeters-to-pixels-y-conversion.html

According to it, 600px is approximately 159mm.

However there is a problem. Pixel size depends on the resolution of the screen so I'm not really sure how that website came up with its conversion.




回答3:


1 millimeter = 3.779527559055 pixel

therefore: 600px/3.7xxxx = 158.75



来源:https://stackoverflow.com/questions/27726232/scale-mm-to-pixels-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!