Window: devicePixelRatio property - Web APIs | MDN
The devicePixelRatio of Window interface returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device. This value could also be interpreted as the ratio of pixel sizes: the size of one CSS pixel to the size of one physical pixel. In simpler terms, this tells the browser how many of the screen's actual pixels should be used to draw a single CSS pixel. This is useful when dealing with the difference between rendering on a standard display versus a HiDPI or Retina display, which use more screen pixels to draw the same objects, resulting in a sharper image. You can use window.matchMedia() to check if the value of devicePixelRatio changes (which can happen, for example, if the user drags the window to a display with a different pixel density). See the example below. A double-precision floating-point value indicating the ratio of the display's resolution in physical pixels to the resolution in CSS pixels. A value of 1 indicates a class
Window: devicePixelRatio property - Web APIs | MDN Skip to main content Skip to search Window: devicePixelRatio property Limited availability This feature is not Baseline because it does not work in some of the most widely-used browsers. Want more browser support for this feature? Tell us why. Learn more See full compatibility The devicePixelRatio of Window interface returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device. This value could also be interpreted as the ratio of pixel sizes: the size of one CSS pixel to the size of one
Explore this link on the map →related reading
- WebGL Resizing the Canvas.webglfundamentals.org
- <meta name="viewport"> HTML attribute value - HTML | MDNdeveloper.mozilla.org
- Departure Monodeparturemono.com
- Frank Chimero · What Screens Wantfrankchimero.com
- Frank Chimero · The Web’s Grainfrankchimero.com
- Web Field Manual | Codewebfieldmanual.com
- Home | AccessAbleaccessable.co.uk
- Transitions.dev — Essential transitions for web appstransitions.dev
- Fields – SOCKSsocks-studio.com
- Sorrel Salb | Are.naare.na
- GitHub - prathyvsh/semantic-zoom: Github repository to catalogue semantic zoom interaction patterns · GitHubgithub.com
- Intersection Observer API - Web APIs | MDNdeveloper.mozilla.org