Which is better, CSS or JavaScript for animation?

Neither is universally better — it depends on whether the animation needs runtime control. CSS wins for simple, stateless motion like hover states, fades, and spinners: it's lighter, dependency-free, and can run on the browser's compositor thread for smooth 60fps. JavaScript wins when you need to pause, reverse, seek, sync to scroll, or orchestrate multi-step timelines. The best production sites use both — CSS for the simple 80%, JS for the orchestrated 20%.