Leçon 3 sur 5
Animations : donner vie au CSS
Une animation CSS fait évoluer un élément dans le temps. On décrit les étapes avec @keyframes, puis on les applique avec la propriété animation.
@keyframes float définit les images clés (from → to) ; animation: float 1s infinite les relie à l'élément, avec une durée et une répétition.
@keyframes float {
from { transform: translateY(0); }
to { transform: translateY(-12px); }
}
.badge { animation: float 1s infinite alternate; }🎯 Ton objectif
Ajoute un bloc @keyframes nommé float (par ex. de translateY(0) à translateY(-12px)), puis applique-le à .badge avec animation: float 1s infinite. L'élément .badge doit avoir une animation nommée et une durée.
Leçon PRO
Ce chapitre avancé fait partie de CodeAge PRO. Débloque-le pour continuer ton aventure.
Découvrir PRO →