Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

Disable animation with prefers-reduced-motion

$
0
0

Today I wondered how someone would reset animations based on the prefers-reduced-motion property. I found this link which is very useful but the discussion is ongoing there. The code which I tried works but I'm wondering about the best-practice for this task.

My code:

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-delay: -1s !important;
    animation-duration: 1s !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
  }
}

How could this be improved? Is this the best solutions or do I miss something?


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>