CSS Animation Tutorial

Understanding CSS Animation

CSS animations allow you to change property values smoothly over a specified duration. Animations can make your webpage more interactive and engaging. The main components of a CSS animation are:

Animation Example

Moving Box

In the example above, the `.box` is animated using the `moveBox` keyframe animation. The box will move horizontally and change color over 3 seconds and repeat infinitely.

Understanding the Keyframes

The `@keyframes moveBox` defines the animation steps:

Quiz: Test Your Knowledge on CSS Animations

1. What does the `@keyframes` rule define in CSS animations?




2. What does the `animation: moveBox 3s ease-in-out infinite;` declaration do?




3. What does the `infinite` value do in the animation?