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.
Syntax
CSS Syntax
syntax.css
@media (min-resolution:<resolution>) { … }
Also valid: (max-resolution: …), exact (resolution: …), and range forms like (resolution >= 2dppx).
Safe default.1px border looks solid on 1× screens.
Match Retina.min-resolution: 2dppx (same idea as 2x).
Thin the line.0.5px can look sharper on dense displays.
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).
Compatibility
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 Chrome68+
Full support
Mozilla Firefox62+
Full support
Apple Safari16+
Full support
Microsoft Edge79+
Full support
Opera55+
Full support
Samsung Internet10.1+
Full support
Internet ExplorerNo
Not supported
resolutionWidely supported
Bottom line: Safe for modern production. Keep usable 1× defaults for older clients.
Remember
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.