CSS Reference ยท Media Queries and Features
The prefers-reduced-data media feature
Reference for the CSS prefers-reduced-data media feature: a request to use less data. Syntax, values, an example and why browser support is currently limited.
The prefers-reduced-data media feature is meant to tell your CSS that the user wants to use less network data, for example because they are on a metered connection or have turned on a data-saver mode. You could then skip large background images or web fonts.
Browser support is very limited. At the time of writing, no major browser ships it enabled by default. Never make the page depend on it; treat it as a progressive enhancement that is almost always no-preference.
@media (prefers-reduced-data: reduce) { .hero { background-image: none; } }
Try it
In a browser without support, the query is simply ignored (or never matches), so the default styling applies. The example below is written so that this is perfectly fine.
Syntax
@media (prefers-reduced-data: no-preference) { /* ... */ } @media (prefers-reduced-data: reduce) { /* ... */ } @media (prefers-reduced-data) { /* matches reduce */ }
Values
| Value | Description |
|---|---|
no-preference |
The user has not asked to save data. |
reduce |
The user prefers that the page transfers less data. |
Usage notes
- A gradient is not a saving. CSS gradients cost no network data. The example above only shows the syntax; real savings come from skipping image files, video and fonts.
- A background image URL inside a skipped rule is not fetched. Put the image reference inside a
@media (prefers-reduced-data: no-preference)block and browsers that understand the feature will not download it when the user wants to save data. - Do not rely on it. Because support is limited, use other techniques as well: responsive images,
loading="lazy", compressed assets and modern formats. - Server hints. The
Save-DataHTTP request header and the JavaScript Network Information API are separate mechanisms with their own support limits. - Unknown features. A browser that does not know a media feature treats the query as not matching, so the
reduceblock simply never applies.
Browser support
Limited: the feature is not enabled by default in the major browsers, so check a compatibility table before relying on it at all.
Related
prefers-reduced-motionโ a preference with broad support@mediaโ the at-rule- Lesson: Media Queries