The resolution media feature targets screen pixel density. Serve sharper styles and assets on Retina and high-DPI displays with min-resolution queries.
01
@media
Media query.
02
min-res
High DPI.
03
dpi
Dots/inch.
04
dppx
Density.
05
Retina
2dppx.
06
vs srcset
Images.
Fundamentals
Introduction
Standard screens use roughly 96 dpi (1 CSS pixel per device pixel). Retina and high-DPI phones pack more pixels into the same space — text and images can look blurry if you only provide low-resolution assets.
The @media (min-resolution) feature lets CSS detect that density and apply sharper borders, larger icons, or adjusted typography on dense screens.
Definition and Usage
Write @media (min-resolution: 2dppx) or @media (min-resolution: 192dpi) to match Retina-class displays. Use max-resolution for low-density fallbacks when needed.
💡
Beginner Tip
For images, prefer HTML srcset or CSS image-set(). Use resolution media queries for pure CSS adjustments like hairline borders and font smoothing.
Foundation
📝 Syntax
Use min-resolution, max-resolution, or exact resolution inside @media:
syntax.css
/* Retina and high-DPI screens (2× density) */@media(min-resolution:2dppx){/* High-DPI styles */}/* Same threshold in dpi (2 × 96 = 192) */@media(min-resolution:192dpi){/* Equivalent Retina query */}/* Low-density screens only */@media(max-resolution:1.49dppx){/* Standard-DPI fallback */}
Accepted Units
dpi — Dots per inch. Standard displays are ~96dpi; Retina is ~192dpi.
Test on real devices — Retina MacBooks and modern phones show the difference.
SVG for icons — Vector icons scale cleanly; resolution queries matter less for SVG.
Watch Out
⚠️ Common Pitfalls
Invalid syntax — @media resolution: is wrong; use (min-resolution: 2dppx).
Confusing with viewport size — High resolution does not mean large screen; a phone can be 3dppx.
Replacing srcset — Do not use resolution queries as the primary image delivery strategy.
Forgetting standard displays — Always provide good 1dppx defaults.
0.5px borders everywhere — Some old browsers render half pixels poorly; test fallbacks.
A11y
♿ Accessibility
Do not shrink text — High-DPI screens still need readable font sizes.
Contrast still matters — Sharp pixels do not fix low color contrast.
Zoom support — Resolution queries must not block user text scaling.
Meaningful images — High-res decorative images should not slow page load.
Focus visibility — Hairline focus rings may be too thin; keep focus styles visible.
🧠 How resolution Works
1
Browser reads device density
Reports dpi, dppx, or dpcm for the output screen.
Detect
2
min-resolution compares threshold
Matches when density meets or exceeds your value.
Match
3
@media rules apply
High-DPI styles update borders, fonts, and backgrounds.
Apply
=
💻
Crisp on every screen
UI looks sharp on Retina and standard displays alike.
Compatibility
🖥 Browser Compatibility
The resolution media feature with dpi and dppx is supported in all modern browsers.
✓ Baseline · Universal support
Resolution media queries
Works in Chrome, Firefox, Safari, Edge, and Opera.
99%Global support
resolution media feature99% supported
Bottom line:min-resolution is production-ready. Pair with srcset for responsive images.
Wrap Up
🎉 Conclusion
The resolution media feature helps you fine-tune CSS for high-DPI screens. Use min-resolution: 2dppx or 192dpi to target Retina displays with sharper borders, adjusted typography, and optional 2× backgrounds.
For images, prefer srcset. For everything else CSS controls, resolution queries keep your UI crisp on dense screens.
The resolution media feature matches the pixel density of the output device — how many dots fit in each inch or pixel unit. Use min-resolution to target high-DPI screens like Retina displays with sharper assets or adjusted typography.
What units does resolution accept?
Common units are dpi (dots per inch), dppx (dots per CSS pixel), and dpcm (dots per centimeter). Retina screens are typically 2dppx, equivalent to 192dpi.
What is the difference between min-resolution and resolution?
min-resolution matches when device density is at least the given value (most common). max-resolution matches at most the value. An exact resolution query matches only that density.
Should I use resolution queries or srcset for images?
For images, prefer HTML srcset or CSS image-set() so the browser picks the best file. Use resolution media queries for CSS-only tweaks like borders, shadows, or font smoothing on high-DPI screens.
Is resolution widely supported in browsers?
Yes. min-resolution with dpi and dppx is supported in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera.