使用 css 像素计算屏幕尺寸,哪里错了?

using css pixel calculating screen size, where is wrong?

在cssw3(here),

1px = 0.75pt, 1pt = 2.54/72 cm, 所以 1 css 像素:1px = 0.26mm

例如iPhone4的CSS像素为320px * 480px(不是设备像素),
所以在宽度上,长度应该是:

320 *0.26 = 83.2mm

但是iPhone4是3.5",所以长宽大约是60mm,

它与我上面计算的结果不匹配
哪里错了?
谢谢

物理单位是按96dpi计算的,所以css中的1in是96px,所以3.5in = 336px。这里有一个博客 post 可以对此进行解释:http://www.quirksmode.org/blog/archives/2012/11/the_css_physica.html 但如果您向下滚动一点,您 post 编辑的 W3 规范中也提到了它。

The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length.

一个CSS像素并不总是0.26mm

来自CSS W3:

The reference pixel is the visual angle of one pixel on a device with a pixel density of 96dpi and a distance from the reader of an arm's length. For a nominal arm's length of 28 inches, the visual angle is therefore about 0.0213 degrees. For reading at arm's length, 1px thus corresponds to about 0.26 mm (1/96 inch).

iPhone4 不是 96dpi。设备像素比为 2 时,其 "CSS dpi" 约为 163。由于 96dpi 设备在 83.2mm 处呈现 320px,从数学上讲,163dpi 设备应在 49mm 处呈现 320px。