Получить «реальные» миллиметры в CSS на не-high-DPI устройстве
Сразу скажу, что я не фронтендер. Есть задача: отобразить на экране лист формата A4 с точностью до миллиметра (в пределах определённой погрешности). Читаю MDN:
For low-dpi devices, the unit
pxrepresents the physical reference pixel; other units are defined relative to it. Thus,1inis defined as96px, which equals72pt. The consequence of this definition is that on such devices, dimensions described in inches (in), centimeters (cm), or millimeters (mm) don't necessary match the size of the physical unit with the same name.For high-dpi devices, inches (
in), centimeters (cm), and millimeters (mm) are the same as their physical counterparts. Therefore, thepxunit is defined relative to them (1/96 of 1 inch).
При этом определения понятия «_high-dpi_» или «_high-resolution_» я не нашёл, но 96 dpi — это явно не оно. Нынешний вариант вёрстки, который не отображает верный размер на устройстве:
<!DOCTYPE html>
<html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content= "width=device-width,initial-scale=1.0"/>
<style>
html { background-color: grey; }
body {
background-color: white;
height: 297mm;
width: 210mm;
margin: 1cm auto;
}
</style>
<title></title>
</head>
<body>
</body>
</html>
Есть ли возможность сделать миллиметры «настоящими» для таких устройств без JavaScript? Или, если с ним, то как?