What are the challenges of using CSS animations and how can you mitigate them?
Instruction: Explain the potential pitfalls of CSS animations and strategies to optimize their use.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Animation can consume rendering resources, distract users and create motion discomfort. Keep the underlying content usable without motion, and add nonessential effects only when appropriate.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS example</title> <style> .notice { padding: 1rem; border: 1px solid; } @keyframes arrive { from { opacity: 0; transform: translateY(4px); } } @media (prefers-reduced-motion: no-preference) { .notice { animation: arrive 200ms...