CSS resolution Media Feature

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 4 Examples
Media Queries

What You’ll Learn

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.

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.

📝 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.
  • dppx — Dots per CSS pixel. 1dppx = standard, 2dppx = Retina.
  • dpcm — Dots per centimeter (less common; 1dppx ≈ 37.8dpcm).

Common Pixel Densities

1dppx 96dpi
Standard
1.5dppx 144dpi
Many Android
2dppx 192dpi
Retina

resolution vs min-width

@media (min-resolution: 2dppx) Pixel density — “Is this a sharp, high-DPI screen?”
@media (min-width: 48rem) Viewport width — “Is the browser window wide enough?”

resolution vs srcset

@media (min-resolution: 2dppx) CSS density query — tweak styles, borders, and typography per density.
<img srcset="..."> HTML image selection — browser picks the best image file per density.

Basic Example

resolution-basic.css
body {
  background-color: #f1f5f9;
}

@media (min-resolution: 192dpi) {
  body {
    background-color: #dbeafe;
  }
}

Default Value

There is no CSS default. Without a resolution query, styles apply at all densities. Most desktops are 1dppx (96dpi).

Syntax Rules

  • Prefer min-resolution: 2dppx or 192dpi for Retina targeting.
  • Combine with commas for fallback: (min-resolution: 2dppx), (min-resolution: 192dpi).
  • Do not use the invalid syntax @media resolution: from outdated tutorials.
  • Combine with width: @media (min-width: 48rem) and (min-resolution: 2dppx).
  • Use -webkit-min-device-pixel-ratio only for legacy support; prefer standard min-resolution.

Related Topics

@media (min-resolution: 2dppx) @media (min-resolution: 192dpi) @media (min-resolution: 1.5dppx)

⚡ Quick Reference

QuestionAnswer
Feature namesresolution, min-resolution, max-resolution
What it measuresDevice pixel density
Standard display1dppx / 96dpi
Retina display2dppx / 192dpi
Common unitsdpi, dppx, dpcm
ImagesPrefer srcset over resolution queries
Browser supportAll modern browsers

When to Use resolution

Reach for min-resolution when pixel density affects appearance:

  • Hairline borders — Use 0.5px or thinner borders on 2dppx screens.
  • Icon sizing — Swap to SVG or larger PNG assets on high-DPI displays.
  • Font smoothing — Adjust -webkit-font-smoothing on dense screens.
  • Background images — Serve 2× background assets when CSS images are unavoidable.
  • Shadows and details — Fine-tune box-shadow blur for crisp rendering.

👀 Live Preview

This block is gray on standard displays (1dppx) and turns blue on Retina / high-DPI screens (min-resolution: 2dppx):

Pixel Density Demo Your screen’s resolution determines the color Standard: gray · High-DPI (2dppx+): blue

Examples Gallery

Practice resolution with dpi backgrounds, dppx typography, hairline borders, and combined width queries.

📜 Core Patterns

Target high-DPI screens with resolution media queries.

Example 1 — Background on high-resolution displays

Change the page background when density is at least 192dpi (Retina):

resolution-dpi.css
body {
  background-color: #f1f5f9;
}

@media (min-resolution: 192dpi) {
  body {
    background-color: #dbeafe;
  }
}
Try It Yourself

How It Works

Classic beginner demo from the reference tutorial, with corrected syntax (no invalid @media resolution: prefix).

Example 2 — Larger text on high pixel density

Bump font size when density is at least 1.5dppx:

resolution-dppx.css
p {
  font-size: 1rem;
}

@media (min-resolution: 1.5dppx) {
  p {
    font-size: 1.25rem;
  }
}
Try It Yourself

How It Works

dppx is often easier to reason about than dpi — 1.5dppx means 1.5 device pixels per CSS pixel.

Example 3 — Hairline border on Retina

Use a thinner border on high-DPI screens for crisp dividers:

resolution-border.css
.card {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

@media (min-resolution: 2dppx) {
  .card {
    border-width: 0.5px;
  }
}
Try It Yourself

How It Works

A 1px border can look thick on Retina. Half-pixel borders render sharper on dense displays.

Example 4 — Combined with min-width

Apply high-DPI styles only on wide, dense screens (desktop Retina):

resolution-combined.css
.hero {
  background-size: cover;
  background-image: url("hero.jpg");
}

@media (min-width: 48rem) and (min-resolution: 2dppx) {
  .hero {
    background-image: url("hero@2x.jpg");
  }
}
Try It Yourself

How It Works

Combining width and resolution avoids loading heavy 2× assets on small high-DPI phones when a simpler image suffices.

🛠 Usage Tips

  • Prefer srcset for images — Let the browser pick image files; use resolution for CSS-only tweaks.
  • Use dppx for clarity2dppx maps directly to device pixel ratio.
  • Provide dpi fallback(min-resolution: 2dppx), (min-resolution: 192dpi) covers older syntax needs.
  • 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.

⚠️ 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.

♿ 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.

🖥 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 feature 99% supported

Bottom line: min-resolution is production-ready. Pair with srcset for responsive images.

🎉 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.

💡 Best Practices

✅ Do

  • Use min-resolution: 2dppx
  • Prefer srcset for images
  • Default for 1dppx
  • Combine with min-width
  • Test on Retina devices

❌ Don’t

  • Use invalid syntax
  • Confuse with viewport width
  • Replace srcset entirely
  • Shrink text on high-DPI
  • Skip 1dppx fallbacks

Key Takeaways

Knowledge Unlocked

Five things to remember about resolution

Use these points when targeting high-DPI screens.

5
Core concepts
dpi 02

192dpi

Same as 2dppx.

Unit
min 03

min-resolution

Most common.

Syntax
img 04

srcset

For images.

Pattern
! 05

Not width

Density only.

Pitfall

❓ Frequently Asked Questions

What does the CSS resolution media feature do?

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.

Practice in the Live Editor

Open the HTML editor and experiment with @media (min-resolution: 2dppx) on your device.

HTML Editor →

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.

5 people found this page helpful