mozilla
Your Search Results

    Window.devicePixelRatio

    The Window.devicePixelRatio read-only property returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of one CSS pixel. Note that as the page is zoomed in the number of device pixels that one CSS pixel covers increases, and therefore the value of devicePixelRatio will also increase.

    There are no callbacks or events to listen to when this value changes (for example, if you drag the window between displays with different densities).

    Syntax

    value = window.devicePixelRatio;
    

    Example

     

    Specification

    CSSOM View Module

    Browser compatibility

     

    See also

    Document Tags and Contributors

    Contributors to this page: fscholz, Jonathan_Watt, teoli, Sole
    Last updated by: fscholz,
    Hide Sidebar