devicePixelRatio property
Gets the device resolution (the ratio between physical device pixels and DPI-adjusted logical CSS pixels).
![]() |
Syntax
| JScript | |
|---|
Property values
Type: Floating-point
The device pixel ratio
Remarks
The devicePixelRatio is similar to the device resolution calculated for Media Queries, except the output is in dots-per-pixel instead of dots-per-inch. In other words,
window.devicePixelRatio = window.screen.deviceXDPI / window.screen.logicalXDPI
See also
Show:
