Preference Media Queries — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the Preference Media Queries lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Animate only when welcome
easy10 minWhen no reduced motion is requested, make #text teal.
- 2
Respond to the colour scheme
easy10 minIn a light scheme, make #text navy.
- 3
Respond to contrast
easy10 minWhen no special contrast is requested, make #text olive.
- 4
Keep the motion guarded
easy10 min#box animates for 0.3s; only remove that under reduced motion.
- 5
Combine two preferences
medium10 minLight scheme navy text, and a 0.3s animation kept outside the reduce branch.
Find the bug(5)
- 1
Fix the wrong motion branch
easy8 minThis styling is for people who have not asked for reduced motion.
- 2
Fix the wrong colour scheme
easy8 minThis rule is meant for the light scheme.
- 3
Fix the missing prefix
easy8 minThe feature is prefers-contrast.
- 4
Fix the motion removed for everyone
easy8 minStripping the animation unconditionally ignores people who want it.
- 5
Fix the misspelled value
easy8 minThe value is no-preference.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace