CSS - Resolution

About

resolution is a media feature that is used in media query to target styling rule to a specific device.

Example

(max-width: 375px) and (min-resolution:192dpi) 180px

Javascript Calculation

The resolution with javascript can be calculated by multiplying the device pixel ratio by 96.

console.log("The resolution of this device is "+window.devicePixelRatio*96+" dpi (ie pixel ratio of "+window.devicePixelRatio+").");

Powered by ComboStrap