Lesson 3 of 5
Animations: bring CSS to life
A CSS animation makes an element change over time. You describe the steps with @keyframes, then apply them with the animation property.
@keyframes float defines the key frames (from → to); animation: float 1s infinite links them to the element, with a duration and a repeat.
@keyframes float {
from { transform: translateY(0); }
to { transform: translateY(-12px); }
}
.badge { animation: float 1s infinite alternate; }🎯 Your goal
Add a @keyframes block named float (e.g. from translateY(0) to translateY(-12px)), then apply it to .badge with animation: float 1s infinite. The .badge element must have a named animation and a duration.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →