HTML & CSS Masterclass Tutorial

Comprehensive guide to modern HTML and CSS development.

Animations

CSS Animations (@keyframes)

While transitions require a trigger (like hovering), animations can run automatically, loop infinitely, and contain complex multi-step sequences.

How it works:

  1. Define Keyframes: Use the @keyframes rule to specify the CSS styles at different stages (e.g., 0%, 50%, 100%).
  2. Apply the Animation: Bind the animation to an element using the animation property (specifying the keyframe name, duration, timing function, and iteration count).

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics