CSS Animation
CSS animations let elements change appearance over time without JavaScript, using @keyframes to define the steps and the animation property to apply them. They power effects like fades, spins, and slides.
Web
You define a @keyframes rule listing how styles change from start to finish, then attach it to an element with the animation shorthand, setting things like duration, timing, and repeat count.
For simple state changes (like a hover color shift) a transition is often enough; reach for animations when you need multi-step or looping motion.
Examples
CSS
@keyframes spin {
to { transform: rotate(360deg); }
}
.loader {
animation: spin 1s linear infinite;
}Output:
Continuously rotates the loader element a full turn every second.