Discover how a simple setting can make your website comfortable for everyone, even those sensitive to motion!
Why Reduced motion support in Bootsrap? - Purpose & Use Cases
Imagine you design a website with lots of animations and moving parts to make it look cool and lively.
But some visitors feel dizzy or uncomfortable because of all the motion.
If you try to fix this manually, you must guess who needs less motion and rewrite or remove animations everywhere.
This is slow, error-prone, and can break your design for others.
Reduced motion support lets your site detect if a user prefers less animation and automatically adjusts or disables motion effects.
This keeps your site accessible and comfortable for everyone without extra work.
@media (max-width: 600px) { /* no motion here */ }
/* but no way to detect user motion preference */@media (prefers-reduced-motion: reduce) {
/* disable or simplify animations here */
}Your website becomes welcoming and easy to use for people sensitive to motion, improving accessibility and user experience.
A news site uses subtle fade-ins for images but turns off these animations for users who prefer reduced motion, so everyone reads comfortably.
Manual fixes for motion sensitivity are slow and unreliable.
Reduced motion support automatically respects user preferences.
This makes websites more accessible and user-friendly for all.
Practice
@media (prefers-reduced-motion: reduce) in Bootstrap?Solution
Step 1: Understand the media query purpose
The media query@media (prefers-reduced-motion: reduce)checks if the user has requested reduced motion in their system settings.Step 2: Connect to accessibility goals
This helps improve accessibility by reducing or disabling animations that might cause discomfort or distraction.Final Answer:
To detect if the user prefers fewer animations for accessibility -> Option BQuick Check:
Reduced motion media query = detect user preference [OK]
- Thinking it speeds up animations
- Assuming it adds more animations
- Confusing it with color scheme changes
Solution
Step 1: Recall the exact media query syntax
The correct media query to detect reduced motion preference is@media (prefers-reduced-motion: reduce).Step 2: Compare options
@media (prefers-reduced-motion: reduce) { } matches the exact syntax. Other options have incorrect property names or values.Final Answer:
@media (prefers-reduced-motion: reduce) { } -> Option CQuick Check:
Correct media query syntax = @media (prefers-reduced-motion: reduce) { } [OK]
- Using wrong media feature names
- Swapping 'reduce' with 'no-preference'
- Missing parentheses or braces
div {
animation: slide 2s infinite;
}
@media (prefers-reduced-motion: reduce) {
div {
animation: none;
}
}Solution
Step 1: Understand the base animation
The div normally has a sliding animation that repeats infinitely.Step 2: Analyze the media query effect
When the user prefers reduced motion, the media query setsanimation: none;on the div, stopping the animation.Final Answer:
The div will have no animation and stay still -> Option AQuick Check:
Reduced motion disables animations = The div will have no animation and stay still [OK]
- Assuming animation speeds up
- Thinking animation continues unchanged
- Believing element disappears
@media prefers-reduced-motion: reduce {
.btn {
animation: none;
}
}What is the error?
Solution
Step 1: Check media query syntax
The media query must have parentheses around the feature:@media (prefers-reduced-motion: reduce).Step 2: Identify the missing parentheses
The given code misses parentheses, so the media query is invalid and ignored by browsers.Final Answer:
Missing parentheses around the media feature -> Option AQuick Check:
Media queries require parentheses [OK]
- Forgetting parentheses in media queries
- Using wrong CSS selectors
- Thinking animation:none is invalid
Solution
Step 1: Use the correct media query for reduced motion
Only styles inside@media (prefers-reduced-motion: reduce)apply when user requests reduced motion.Step 2: Disable animations and transitions on .fade
Settinganimation: none !important;andtransition: none !important;ensures Bootstrap's fade animations are turned off.Step 3: Check other options
.fade { animation-duration: 0s; } disables animation always, ignoring user preference. @media (prefers-reduced-motion: no-preference) { .fade { animation: none; } } uses wrong media query value. .fade { animation: none; } disables animation always, not respecting user choice.Final Answer:
@media (prefers-reduced-motion: reduce) { .fade { transition: none !important; animation: none !important; } } -> Option DQuick Check:
Disable animations inside reduced motion media query [OK]
- Disabling animations globally ignoring user preference
- Using wrong media query values
- Not disabling both animation and transition
Ready to prove it?
Pass the test and this pattern moves unknown
