The resolution CSS media feature can be used to test the pixel density of the output device.


The resolution feature is specified as a <resolution> value representing the pixel density of the output device. It is a range feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively.



<p>This is a test of your device's pixel density.</p>


/* Exact resolution */
@media (resolution: 150dpi) {
  p {
    color: red;

/* Minimum resolution */
@media (min-resolution: 72dpi) {
  p {
    text-decoration: underline;

/* Maximum resolution */
@media (max-resolution: 300dpi) {
  p {
    background: yellow;



Specification Status Comment
Media Queries
The definition of 'resolution' in that specification.
Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 29Edge ? Firefox Full support 8
Full support 8
Partial support 3.5
Notes Supports <integer> values only.
IE ? Opera Full support YesSafari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

Document Tags and Contributors

Contributors to this page: Artoria2e5, connorshea, ExE-Boss, mfluehr, kscarfone, cvrebert
Last updated by: Artoria2e5,