Preskoči na glavni sadržaj
← 📄 HTML & the platform·Modul A5 · Lekcija 6
ZadatakAdd a CSS @media (prefers-reduced-motion: reduce) block that kills every animation and transition globally. Use the universal selector and the standard 'animation-duration: 0.01ms' + 'transition-duration: 0.01ms' pattern.

preferira-smanjeno-kretanje

100 XP7 min
Teorija

Some users get nauseous from animation

About 2-3% of people experience vestibular dysfunction. Parallax scrolling, animated backgrounds, page-transition spins make them physically ill. macOS/iOS/Android/Windows have a "Reduce motion" toggle in accessibility settings, and CSS can read it:

.hero {
  animation: pulse 2s infinite;
  transition: transform 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .hero {
    animation: none;
    transition: none;
  }
}

A common pattern: "global motion off"

Most projects ship one global reset block:

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

This kills every animation site-wide for opted-in users. 0.01ms instead of 0s keeps event listeners that depend on animationend working.

When to NOT respect it

Animation that's part of the user-facing FEATURE (a chart animating in real time) is content, not decoration — keep it. The opt-out is for incidental motion (hovers, parallax, page transitions, loading spinners that spin gratuitously).

Test it

In macOS: System Settings → Accessibility → Display → Reduce motion. In Chrome DevTools: Rendering panel → "Emulate CSS media feature prefers-reduced-motion."

🔒

Registriraj se i počni kodirati

Teorija je otvorena svima. Editor, pregled uživo i provjera otključavaju se s 7-dnevnim besplatnim probnim periodom — potrebna kartica, otkaži kad god.

Registracija — besplatan probni period →

Prvih 10 lekcija u svakom smjeru je besplatno. Bez kartice.

← PrethodnaSljedeća lekcija →

Jedan Python ili web savjet dnevno — emailom

Kratko, ručno pisano, bez spama. Odjavi se jednim klikom.