CSS Reference ยท Media Queries and Features
The prefers-reduced-motion media feature
Reference for the CSS prefers-reduced-motion media feature: detect users who want less animation, the reduce and no-preference values, examples and good practice.
The prefers-reduced-motion media feature reports whether the user has asked their operating system to minimize non-essential motion. People enable that setting because large movements, parallax, zooming and spinning can cause dizziness, nausea or distraction. Your CSS can read the setting and tone animations down.
The feature is a user preference, not a device capability, so treat it as a request you should honor rather than a hint you may ignore.
@media (prefers-reduced-motion: reduce) { .card { animation: none; transition: none; } }
Try it
The box below slides back and forth. If your system is set to reduce motion, the animation is switched off and a label says so. Turn the setting on and off in your operating system to compare.
Syntax
@media (prefers-reduced-motion: reduce) { /* ... */ } @media (prefers-reduced-motion: no-preference) { /* ... */ } @media (prefers-reduced-motion) { /* same as reduce */ }
This is a discrete media feature. It is a boolean when written without a value, and it has no range form.
Values
| Value | Description |
|---|---|
no-preference |
The user has not asked for less motion. |
reduce |
The user wants non-essential motion removed or minimized. |
Usage notes
- Reduce, do not always remove. Replace large movement (sliding, zooming, parallax, auto-playing carousels) with fades or instant changes. Small feedback such as a color change on hover is usually fine.
- Two ways to write it. Either turn animations on only inside
(prefers-reduced-motion: no-preference), which is safest because unsupported or unknown cases stay still, or define animations normally and switch them off insidereduce. - A blanket reset is a blunt tool. Setting every
animation-durationandtransition-durationto a tiny value works as a safety net but can break scripts waiting foranimationend. Targeted rules are better. - Essential motion. A progress indicator may still need to move. Keep it, but make it gentle.
- JavaScript. Read the same setting with
window.matchMedia("(prefers-reduced-motion: reduce)").matches, for example to stop autoplay video. - Test it. Browser developer tools can emulate the preference, so you do not need to change your system settings.
Browser support
Supported in all current major browsers; check a compatibility table if you need to support very old versions.
Related
@mediaโ the at-rule that hosts media featuresprefers-color-schemeโ light or dark preferenceprefers-contrastโ contrast preference- Lessons: Motion and Performance, Media Queries