我有一个小型触摸屏显示器,我们正在为其提供 HTML 页面。 LCD 的物理尺寸为 4.624 厘米宽 x 3.508 厘米高。创建一个具有 width
和 height
设置的 div
会在显示器上创建一个小得多的矩形。
为什么 cm
不能转换为屏幕上的实际尺寸?我需要进行哪些调整才能以厘米而不是像素为单位工作?
最佳答案
正如 w3c 文档所述:
The so-called absolute units (cm, mm, in, pt and pc) mean the same in CSS as everywhere else, but only if your output device has a high enough resolution. On a laser printer, 1cm should be exactly 1 centimeter. But on low-resolution devices, such as computer screens, CSS doesn't require that. And indeed, the result tends to be different from one device to another and from one CSS implementation to another.
关于css - 在 `cm` 中指定 CSS 大小不会产生正确的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31010541/