iphone 通用机型的像素说明表格
| 机型 | 物理像素 | dpr[device pixel ratio] | 屏幕尺寸 |
|---|---|---|---|
| iphone 4 | 640 x 960 | 2 | 320 x 480 |
| iphone 5 | 640 x 1136 | 2 | 320 x 568 |
| iphone 6/7/8 | 750 x 1334 | 2 | 375 x667 |
| iphone X | 1125 x 2436 | 3 | 375 x812 |
关于物理像素和开发像素的说明
- 开发人员开发的时候,屏幕尺寸 = 物理像素 / dpr
- dpr 屏幕像素比例
1px问题
在dpr > 1的移动端设备上面,前端设置的1px实际的占用物理像素是2个像素点,所以为了实现1个像素点,可以使用设置initial-scale的方案,比如dpr为2的时候,initial-scale设置为0.5
setOnePx
// weui.setTopLine(@c: #C7C7C7) {content: " ";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid @c;color: @c;transform-origin: 0 0;transform: scaleY(0.5);}
