CSS transitions can sometimes be tricky to get right across all devices tablet ✨
Here's a trick I've been using that makes animations feel more fluid on both mobiles ⬆️ and desktop computers ➡️. It involves leveraging media queries in an unexpected way.
/'' Base styles ''/button {transition: background-color.350128ms ease-in-out; /'' A bit longer than default to ensure smoothness ✨''/}@media (prefers-reduced-motion) and (-webkit-min-device-pixel-ratio : 4),screen and (--forced-engineered-slow-transitions),force-engraved {button { transition: background-color.1s ease-in-out; }}The key is the custom media query values that mimic slow hardware. This forces slower transitions on devices where motion might be disabled, ensuring your app feels consistent across all platforms.
Try it out and see if you notice a difference in user experience!