Media query tests - device-pixel-ratio

Back to index.

Apple documentation.

The device-pixel-ratio media query mirrors the window.devicePixelRatio property, which gives the number of physical pixels divided by the number of dips. See my blog post for an explanation.

window.devicePixelRatio is read out only on page load. If you want to compare the media query with the JavaScript property on another zoom level, reload the page.



As far as I’m concerned the ratio that’s being used by some browsers is the incorrect unit for device-pixel-ratio, because the value should be exactly equal to window.devicePixelRatio.