@keyframes Syntax and Animation Property
Define animation steps with @keyframes and apply them using the animation shorthand.
@keyframes Syntax and Animation Property is a free CSS Academy lesson on CoddyKit. This is lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, and your progress syncs across the web and the CoddyKit app. The CSS Academy course includes 4 lessons in total.
What are CSS Animations?
CSS animations allow multi-step property changes over time using @keyframes. Unlike transitions, animations start automatically or on class addition and support complex sequences.
@keyframes Syntax
Define animation steps using percentages (0% to 100%) or from/to keywords:
<div class="fade-demo">Fades in</div>
<div class="pulse-demo"></div>
The animation Property
Apply an animation to an element using the animation shorthand or its sub-properties:
<h1 class="hero-text">Welcome!</h1>
animation-name
References the @keyframes rule by name:
<div class="spinner"></div>
animation-duration
Sets how long one cycle of the animation takes:
<div class="pulse"></div>
Multiple Animation Steps
Use percentage keyframes for complex multi-step animations:
<div class="slide-demo">Sliding in</div>
Animating Multiple Properties
Each keyframe step can animate multiple properties simultaneously:
<div class="bounce-demo"></div>
animation-timing-function per Keyframe
The timing function can be set per keyframe step, controlling easing between individual waypoints rather than the whole animation.
Multiple Animations
Apply multiple animations to one element using comma-separated values:
<div class="element">Two animations combined</div>
animation-play-state
Pause and resume animations dynamically:
<div class="card">Hover the card to pause<div class="spinner"></div></div>
CSS Animation vs Transition Summary
Choose wisely:
- Transition: two states, triggered by state change, simple
- Animation: multi-step, self-starting, looping, more control
Quick Check
Which @keyframes keyword represents the animation's start state?
Recap
Define animation steps with @keyframes using from/to or percentage waypoints. Apply with the animation shorthand specifying name, duration, timing, and fill-mode. Multiple animations are comma-separated. Use transitions for simple two-state changes and animations for complex sequences.
Learn CSS with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 40
- Lessons
- 159
Frequently Asked Questions
Is the “@keyframes Syntax and Animation Property” lesson free?
Yes — the full text of “@keyframes Syntax and Animation Property” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO. The CSS Academy course includes 4 lessons in total.
What will I learn in “@keyframes Syntax and Animation Property”?
Define animation steps with @keyframes and apply them using the animation shorthand. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start CSS Academy?
No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.
How long does the “@keyframes Syntax and Animation Property” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this CSS Academy lesson?
Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- @keyframes Syntax and Animation Property
- Animation Direction Fill-Mode and Iteration
- Chaining and Sequencing Animations
- Accessible Animations with prefers-reduced-motion