Skip to content
Guest
Learn CSS · Course Syllabus Show lessons
Visual Polish & Motion · 8 min read · Beginner

@keyframes Animations & Reduced Motion

Build multi-step CSS animations like loading spinners and pulsing badges while respecting users' prefers-reduced-motion accessibility settings.

What you'll learn

  • Define multi-step animations with @keyframes and animation
  • Build lightweight CSS-only loading indicators and live status pulses
  • Respect prefers-reduced-motion: reduce for vestibular accessibility

While transition animates between two states (e.g., default → hover), @keyframes lets you choreograph multi-step or looping animations automatically.

Respecting prefers-reduced-motion

Motion that feels playful to some users can trigger dizziness or nausea for people with vestibular disorders. Always guard decorative or looping motion with a media query:

@media (prefers-reduced-motion: reduce) {
  .pulse, .spinner {
    animation: none;
  }
}

Fill-in-the-Blank Exercise

Accessible Keyframe Animation

Define a spin animation and disable it when the user prefers reduced motion.

@ spin {
to { transform: rotate(360deg); }
}
@media (: reduce) {
.spinner { animation: none; }
}

Try It Yourself

Adjust the spinner speed or pulse keyframes below:

CSS Spinner & Live Status Dot
Live Result

Check Your Understanding

Score: 0 / 1

1. Which CSS media query detects when a user has turned on 'Reduce Motion' in their OS settings?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind