🎨 CSS Animation Tutorial

What is CSS Animation?

CSS animations let you smoothly transition property values over time. It adds life to your page. It’s made up of:

Example Animated Box

Moving Box

This box uses moveBox keyframes to move and swap colors over 3 seconds β€” forever.

πŸ’‘ You can control the speed, direction, delay, and repeats of animations using the animation property.

@keyframes Example

@keyframes moveBox {
  0% {
    transform: translateX(0);
    background-color: #03a9f4;
  }
  50% {
    transform: translateX(200px);
    background-color: #e91e63;
  }
  100% {
    transform: translateX(0);
    background-color: #03a9f4;
  }
}

πŸ“ Animation Quiz

1. What does @keyframes define?

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

3. What does infinite mean in animations?