Kevin Powell - CommunityKP-C
Kevin Powell - Communityโ€ข4mo agoโ€ข
20 replies
aidan amoongus

Prefers Reduced Motion

Hi, I was looking into ways for my site to support reduced motion people, like a good dev should ๐Ÿ™‚
I found 2 solutions which I think are quite identical, but I'm not sure if there are any differences. I'd like to see what other people think.


:root {
  --motionOK: 1;
  --transition-timing: 315ms;
}
@media(prefers-reduced-motion: reduce) {
  :root {
    --motionOK: 0;
  }
}

.foo {
  transition: all calc(var(--transition-timing) * var(--motionOK));
}
.foo:hover {
  scale: 1.2;
}


other example:

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
Was this page helpful?