Recent chats
ASKGEEZ Q&A GUIDETechnology & devices

How can CSS honor a user’s reduced-motion preference for transitions?

Quick answer

Put the ordinary transition in your default CSS, then use @media (prefers-reduced-motion: reduce) to remove or reduce motion that is not needed to understand a change. The reduce preference indicates that the user wants nonessential motion minimized. Keep the resulting state clear through a visible color, border, icon, or text change; reducing motion should not hide whether an interaction took effect. [S1] [S2]

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

What’s a straightforward way to make my CSS transitions respect reduced motion? I want to keep a subtle hover effect for people who haven’t asked to reduce motion.

Geez

Keep the usual transition in the default rule, then override it inside a prefers-reduced-motion: reduce media query. That preference lets CSS respond when a user’s device setting asks to minimize nonessential motion. [S1]

For example:

.button {
  background-color: #2457a7;
  color: white;
  transition: background-color 180ms ease, transform 180ms ease;
}

.button:hover {
  background-color: #173f80;
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .button:hover {
    transform: none;
  }
}

With the reduced-motion preference, this example removes the transition and the hover lift. The background still changes immediately, so hover has a visible result. Treat the colors and timing as illustrative; adapt them to your design.

Follow-up question

Should I remove every transition across the whole site, or only some of them?

Geez

Start by identifying which effects create movement that is not necessary to understand the interface: for example, a decorative slide, a lift, or a large animated reveal. Remove or simplify those effects in the reduced-motion rule. MDN describes the preference as a request to minimize nonessential movement; it does not require that every visual state change disappear. [S1]

Then check that the interaction still communicates its result. A button might change color immediately; a selected tab might retain a clear selected style; a focused control should remain distinguishable. The interface should still make clear whether an interaction succeeded. [S2] If an effect conveys essential information, choose a less motion-dependent way to show that information rather than making the change imperceptible.

Follow-up question

How do I make sure both preference settings work, rather than just trusting the CSS?

Geez

Check the page in both conditions: with reduced motion off and with it on. Change the device’s reduced-motion preference, then inspect the same interactions in each setting.

In the ordinary setting, verify that intended transitions appear. In the reduced setting, verify that nonessential movement is absent or simplified and that the resulting state is still apparent. Try the specific controls that use motion—such as hover, focus, selection, opening, or closing—not just the initial page view. This makes it easier to spot a control whose state becomes unclear when its transition is removed.

Follow-up question

Can you give me a small reusable pattern and a checklist I can apply to my own interface?

Geez

Use this as a starting point, replacing the example selector and state styles with your own:

.example-control {
  transition: background-color 160ms ease, transform 160ms ease;
}

.example-control.is-active {
  background-color: #2457a7;
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .example-control {
    transition: none;
  }

  .example-control.is-active {
    transform: none;
  }
}

The .is-active styling is just an example of a state change; use a state your interface actually has. Preserve a clear visual distinction in both settings, such as a different background or border. The media query handles the reduced preference; the default rule remains the behavior when that preference is not active. This pattern is not a guarantee that every motion issue in a page is addressed, so review other animated effects separately.

A practical checklist

  • List transitions and animations, and identify which movement is nonessential.

  • Add a prefers-reduced-motion: reduce rule to remove or simplify nonessential movement.

  • Keep important state changes visible with an immediate color, border, icon, or text change.

  • Check the same interactions with reduced motion off and on.

  • Inspect hover, focus, and active or selected states, not just the initial view.

A few more useful answers

Does `prefers-reduced-motion: reduce` mean every transition must be removed?

It signals a preference to minimize nonessential movement. Review which effects can be removed or simplified, and ensure necessary state changes remain clear. [S1] [S2]

How can I show a change if its transition is removed?

Use a visible result that does not depend on movement, such as a changed color, border, icon, or label. The interface should still communicate the resulting state. [S2]

Should the reduced-motion rule change the state styling too?

It can. For example, remove a movement effect while keeping an immediate color or border change so the state remains apparent.

Sources

References used for this guide.

  1. [S1] prefers-reduced-motion CSS media feature — MDN
    developer.mozilla.org · Checked
  2. [S2] Using media queries for accessibility — MDN
    developer.mozilla.org · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work