A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms;}}</style><main class="demo">Example content</main>
In production, User preferences can alter rendering assumptions. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
The useful mental model here is practical: how CSS can respect reduced motion, contrast, and color-scheme preferences without splitting the design system. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Reduced Motion and User Preferences | User preferences can alter rendering assumptions. |
| Production test | Real content and constraints | The rule works only for the demo values |
| Maintenance | Scope and override path | A later fix creates another exception |
A good CSS change narrows the problem. Treat preference media queries as additional constraints, not separate themes pasted on at the end. This keeps the rule understandable when content, theme, or viewport conditions change later.
<style>@media (prefers-color-scheme:dark){:root{color-scheme:dark;}}</style><main class="demo">Example content</main>
Engineering judgment: Treat preference media queries as additional constraints, not separate themes pasted on at the end.
<style>.demo { color-scheme:light dark; }</style><main class="demo">Example content</main>
Example 3 is useful here because it demonstrates reduced motion and user preferences under a concrete input rather than as an abstract property list.
<style>@media (forced-colors:active){.button{border:1px solid ButtonText;}}</style><main class="demo"><button type="button">Example action</button></main>
Example 4 is useful here because it demonstrates reduced motion and user preferences under a concrete input rather than as an abstract property list.
Finish the lesson once you have worked through the material. This awards ★ 40 XP.