Open-Source CSS Programming • Intermediate • 30 minutes
OSCSS.008 examines how to make interface movement optional without removing useful feedback. A status control may lift when a pointer enters it, but that animation is unnecessary to operate the control. The browser can expose the user’s motion preference to CSS, allowing the developer to make movement opt-in. The earlier container-query lesson examined available space; this lesson examines a different environmental input: a user accessibility preference.
Objectives and prerequisites
Use a modern browser, text editor and developer tools. Review cascade rules, responsive units and selectors. By the end, explain the two preference values, separate visual movement from interaction, and verify both motion settings and keyboard focus.
Motion is an enhancement, not a requirement
The MDN media-feature reference explains that reduce indicates a user preference for less motion. The no-preference value indicates no expressed preference. It does not guarantee that every animation is comfortable. A conservative pattern starts with the stationary design and adds optional movement inside a no-preference query. W3C technique C39 documents the media query as a way to address interaction-triggered animation. This example alone does not establish full WCAG compliance.
Laboratory: a motion-aware status button
Save this complete sample as motion.html. The button is a visual exercise rather than a production status command. There are no external scripts, network requests or destructive operations. Use the following HTML and CSS:
<!doctype html><html lang=”en”>
<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width,initial-scale=1″>
<title>Motion lab</title>
<style>
button { padding: 1rem; transition: none; }
button:focus-visible { outline: 3px solid #175abc; outline-offset: 3px; }
button:hover { background: #dceaff; }
@media (prefers-reduced-motion: no-preference) {
button { transition: transform 200ms ease; }
button:hover { transform: translateY(-3px); }
}
</style>
<button>Inspect status</button>
</html>
The base rule keeps the button stationary. Its hover background provides feedback in either preference mode. The optional query moves the control upward by three CSS pixels in 200 milliseconds. The focus-visible rule remains outside the query so keyboard users retain a visible focus indicator. The control’s label and accessible role do not depend on the animation.

Test results and troubleshooting
Open the page and use browser rendering tools to emulate reduce and no-preference. In Chromium 144.0.7559.96, eight automated assertions passed: both transition durations, both final hover transforms, both keyboard focus-visible states, and both focus outline widths. With reduce, the duration was zero and transform was none. With no-preference, the duration was 0.2 seconds and the hover transform translated the button upward by three pixels. Both modes retained the three-pixel keyboard outline. These results apply to this local test, not every device.
Exercises and answer key
1. Move the query outside the hover selector: predict which rule controls movement. 2. Emulate reduce and inspect computed transform. 3. Change 200ms to 400ms and compare modes. 4. Tab to the button in both modes. 5. Explain why a global rule disabling every animation may be inappropriate.
Answers: 1. Keep motion declarations inside the no-preference query. 2. The reduced-motion button remains stationary. 3. Only the optional transition changes duration. 4. Both modes should retain visible focus. 5. Some animation conveys essential information; provide an equivalent nonmoving alternative rather than indiscriminately removing feedback.
Further reading: MDN accessibility media queries.
Editor’s Note: We volunteer daily to ensure the credibility of the information on this platform is Verifiably True. If you would like to support to help further secure the integrity of our research initiatives, please scan the QR code below

For mobile scanning, open the article on another display and scan the QR code with a Bitcoin wallet. The voluntary donation amount is 5,000 sats. Verify the receiving address 3C9o19EH5HSiwEPyCTmEKzxhNCbo2X6TTb before sending.
BitcoinVersus.Tech publishes technology and financial journalism for informational purposes and does not provide financial, investment, or legal advice.

Leave a Reply