If you’re using a CSS library that comes with animations by default it may be a pain to maintain a modified version of it without animations. It’s easier to write your own CSS to disable animations and transitions.
My motivation behind this post was disabling button animations when using daisyUI on a side project.
To disable CSS animations and transitions you can try adding the following to your CSS:
| |
If that doesn’t work, try using !important:
| |
Animations may also be applied using the ::before and ::after pseudo elements. We can include those in the previous CSS:
| |
You can also put these into a CSS class and apply to HTML elements as needed if you still want animations in some places:
| |
| |
References
- https://stackoverflow.com/questions/11131875/what-is-the-cleanest-way-to-disable-css-transition-effects-temporarily
- https://stackoverflow.com/questions/31576156/what-does-animationnone-do-exactly
- https://developer.mozilla.org/en-US/docs/Web/CSS/animation
- https://developer.mozilla.org/en-US/docs/Web/CSS/transition