CSS resolution Media Feature

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The resolution media feature tests the pixel density of the output device—how many device dots map to each CSS inch or pixel.

It is a range feature: use min-resolution and max-resolution (or modern comparison syntax) to target high-DPI / Retina screens. Common units: dpi, dpcm, dppx, and x (alias for dppx).

Standard-track.

Baseline widely available since September 2022. Not deprecated or experimental.

Non-standard legacy WebKit

-webkit-min-device-pixel-ratio is non-standard. Prefer min-resolution with dppx / x for modern browsers.

CSS Syntax

syntax.css
@media (min-resolution: <resolution>) { … }

Also valid: (max-resolution: …), exact (resolution: …), and range forms like (resolution >= 2dppx).

Feature Values

Unit / queryDescriptionTry it
dpiDots per inch. 192dpi ≈ Retina (2dppx)Try it
dppx / xDots per CSS pixel. 1dppx = 96dpiTry it
min-resolution: 2dppxCommon Retina / high-DPI thresholdTry it
Combined queryPair with width for desktop high-DPITry it

How to Use resolution

Start with 1× styles, then enhance for denser screens.

  1. Ship a solid default that looks fine at 1dppx.
  2. Add @media (min-resolution: 2dppx) (or 192dpi) for Retina tweaks.
  3. Prefer dppx / x for screens; use dpi when thinking in print density.
  4. For images, prefer srcset / image-set(); use resolution queries for CSS-only details.
GoalTypical query
Retina and above(min-resolution: 2dppx)
Mild high-DPI(min-resolution: 1.5dppx)
Legacy dpi form(min-resolution: 192dpi)
Wide + Retina(min-width: 48rem) and (min-resolution: 2dppx)

Live Preview

This browser’s density via matchMedia and devicePixelRatio.

min-resolution matches

Chips light up when each minimum query matches. Density cannot be forced from the page.

Result

Checking…

matchMedia pending

CSS Examples

Each snippet focuses on resolution. Use Try It Yourself for a live editor.

Example 1 — Cue for 192dpi and Above

Change a sample background when density is at least Retina-class.

CSS
<style>
  p {
    background: #f1f5f9;
    padding: 0.75rem;
  }

  @media (min-resolution: 192dpi) {
    p {
      background: #dbeafe;
    }
  }
</style>

<p>Gray by default; blue on 192dpi+ screens.</p>
Try It Yourself

How It Works

  1. Set a default. Light gray background for standard density.
  2. Query density. min-resolution: 192dpi matches ~2× screens.
  3. Apply the cue. Background turns blue when the query matches.
  4. No match. 1× displays keep the gray default.

Example 2 — Slightly Larger Type at 1.5dppx

Bump font size on moderately dense screens.

CSS
<style>
  p {
    font-size: 1rem;
  }

  @media (min-resolution: 1.5dppx) {
    p {
      font-size: 1.25rem;
    }
  }
</style>

<p>Font size increases on 1.5dppx+ screens.</p>
Try It Yourself

How It Works

  1. Baseline type. 1rem for all devices.
  2. Use dppx. 1.5dppx is clearer than guessing dpi.
  3. Scale up. High-density screens get 1.25rem.
  4. Inclusive match. 2dppx and 3dppx also match because the query is a minimum.

Example 3 — Hairline Border on 2dppx

Use a thinner border where the screen can render a crisp half-pixel line.

CSS
<style>
  .card {
    padding: 0.75rem;
    border: 1px solid #94a3b8;
  }

  @media (min-resolution: 2dppx) {
    .card {
      border-width: 0.5px;
    }
  }
</style>

<div class="card">Hairline border on 2dppx screens.</div>
Try It Yourself

How It Works

  1. Safe default. 1px border looks solid on 1× screens.
  2. Match Retina. min-resolution: 2dppx (same idea as 2x).
  3. Thin the line. 0.5px can look sharper on dense displays.
  4. Fallback. Lower-density devices keep the full 1px border.

Edge Cases & Pitfalls

If density styles surprise you, check these first.

range

Prefer min / max over exact

(resolution: 150dpi) matches only that value. Use min-resolution so 2× and 3× both qualify.

images

Images ≠ only resolution CSS

Browser-native srcset / image-set() usually beat swapping backgrounds with media queries alone.

units

CSS inches, not rulers

On screens, dpi / dppx relate to CSS units (96 CSS px per CSS inch), not a physical tape measure.

zoom

Browser zoom can change density

devicePixelRatio and resolution queries can shift when the user zooms. Design so both 1× and 2× still look fine.

print

Printers are high dpi too

Combine with print when paper density matters: @media print and (min-resolution: 300dpi).

Browser Support

resolution is a browser CSS media feature for pixel density. Node.js, Deno, and Bun do not evaluate it.

✓ Baseline · Widely available since Sep 2022

resolution

Supported in Chrome 68+, Firefox 62+, Safari 16+, Edge 79+, Opera 55+. Not supported in Internet Explorer. Older Safari used -webkit-min-device-pixel-ratio.

96% Global support
Google Chrome 68+
Full support
Mozilla Firefox 62+
Full support
Apple Safari 16+
Full support
Microsoft Edge 79+
Full support
Opera 55+
Full support
Samsung Internet 10.1+
Full support
Internet Explorer No
Not supported
resolution Widely supported

Bottom line: Safe for modern production. Keep usable 1× defaults for older clients.

Key Takeaways

  • Role: matches device pixel density with dpi, dpcm, or dppx/x.
  • Common use: (min-resolution: 2dppx) for Retina CSS tweaks.
  • vs images: prefer srcset / image-set() for photo assets.
  • Pitfall: avoid exact resolution: values; use min/max ranges.

One line: use @media (min-resolution: 2dppx) to refine CSS on high-DPI screens; keep solid 1× defaults.

Frequently Asked Questions

It tests the pixel density of the output device. Use min-resolution to style high-DPI (Retina) screens with denser dots per CSS pixel.
dpi (dots per inch), dpcm (dots per centimeter), dppx (dots per CSS px), and x (alias for dppx). 1dppx equals 96dpi. Retina is often 2dppx (192dpi).
Prefer min-resolution / max-resolution (range queries). Exact resolution: 150dpi matches only that density and is rarely useful.
For raster images, prefer HTML srcset or CSS image-set() so the browser picks the file. Use resolution queries for CSS tweaks like borders, shadows, or type.
It is non-standard. Modern browsers support min-resolution with dppx. Keep the WebKit query only if you must support very old Safari.
Baseline widely available since September 2022: Chrome 68+, Firefox 62+, Safari 16+, Edge 79+. Not supported in Internet Explorer. It is a browser CSS media feature, not a Node.js API.

Next: scan

Detect progressive vs interlaced scanning on display devices.

scan tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful