Animations

๐ŸŽจ CSS3+ ๐ŸŸข Chapter 35 of 49 ๐Ÿ“‚ Phase 12: Transforms & Animations ๐Ÿ“… 2026 Edition
๐Ÿ“Œ Covered in this chapter: @keyframes ยท animation-name ยท duration ยท timing ยท delay ยท iteration-count ยท direction ยท fill-mode ยท play-state ยท Loading ยท Entrance ยท Exit ยท Reduced Motion
Welcome to Chapter 35: Animations โ€” part of the CSS Complete Roadmap. This lesson covers all subtopics with clear explanations, code examples, and best practices used in professional web development.
1@keyframes & Animation Properties
CSS โ€” Fade Inโ–ถ Try in Editor
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fade-in 400ms ease-out;
}
  • animation-iteration-count: infinite โ€” loading spinners
  • animation-direction: alternate โ€” back and forth
  • animation-fill-mode: forwards โ€” end state retain
  • animation-play-state: paused โ€” pause on hover
2Loading, Entrance & Exit Animations
CSS
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 800ms linear infinite;
}

@keyframes slide-out {
  to { opacity: 0; transform: translateX(-100%); }
}

.toast-exit {
  animation: slide-out 300ms ease-in forwards;
}

Reduced motion: Always respect prefers-reduced-motion: reduce โ€” disable or simplify animations for vestibular disorder users.

OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท CSS Complete Roadmap ยท Last updated August 2026