设备像素密度测试 (-webkit-min-device-pixel-ratio)

来源:互联网 发布:mindmap for mac 编辑:程序博客网 时间:2024/05/17 04:27

定义:

window.devicePixelRatio是设备上物理像素和设备独立像素(device-independent pixels (dips))的比例。
公式表示就是:window.devicePixelRatio = 物理像素 / dips

dip或dp,(device independent pixels,设备独立像素)与屏幕密度有关。dip可以用来辅助区分视网膜设备还是非视网膜设备。

非视网膜屏幕的iphone上,屏幕物理像素320像素,独立像素也是320像素,因此,window.devicePixelRatio等于1

-webkit-min-device-pixel-ratio有哪些值?

  • 1.0
  • 1.3
  • 1.4
  • 1.5
  • 2.0
  • 2.6
  • 3.0
0 0