How to calculate device pixel ratio

后端 未结 6 1455
独厮守ぢ
独厮守ぢ 2020-12-14 01:44

I would like to know how the -webkit-device-pixel-ratio is calculated. I had already read this. Yet I am unable to understand it clearly. I would also like to know if there

6条回答
  •  自闭症患者
    2020-12-14 02:15

    The problem is that there is no one database with all of (even the most common) devices listed, so looking up the viewport specs for a given device are a case of trying to find the device in any one of several databases.

    These are the databases that I've come across and used, that list device viewports along with their pixel ratios:

    • https://yesviz.com/devices.php (currently the most comprehensive)
    • http://dpi.lv/
    • https://www.mydevice.io/#compare-devices
    • https://viewportsizer.com/devices/
    • http://screensiz.es

    Feel free to add to the list above, as I'm sure there are much more comprehensive databases out there.

    Also remember that resolution / DPR = viewport, so for testing the responsiveness of a site you generally only need one of either DPR or viewport, and the viewport itself is generally better.

提交回复
热议问题