CSS Animation Properties Reference

All @keyframes and animation-* properties with timing functions and fill modes.

Searchable CSS animation property reference covering animation-name, duration, timing-function, delay, iteration-count, direction, fill-mode, play-state, scroll timelines and @keyframes with values and defaults.

What is the difference between fill-mode forwards and both?

forwards keeps the styles of the last keyframe after the animation ends. backwards applies the first keyframe's styles during the delay before it starts. both does both at once, so the element looks animated from the moment it is rendered through after it finishes.

Driving motion with @keyframes

CSS animations interpolate an element between waypoints defined in a @keyframes rule, controlled by the animation-* family of properties. This reference lists each longhand, the animation shorthand and @keyframes itself, with accepted values, initial values and the behaviour worth remembering.

How it works

You define waypoints in @keyframes name { from { … } to { … } } or with percentage stops, then attach them with animation-name and a non-zero animation-duration. The remaining longhands shape playback: timing-function sets the easing between keyframes, iteration-count and direction control repetition and bounce, delay offsets the start (negative delays seek into the animation), and fill-mode decides whether the start or end keyframe persists outside the active window.

The animation shorthand packs these together; its only strict rule is that the first <time> is the duration and the second is the delay. Newer properties animation-timeline and animation-range replace the clock with scroll progress for scroll-driven effects. Filter the list above to find any property fast.

Tips and accessibility

  • Always provide both a name and a non-zero duration; with duration: 0s nothing visibly animates.
  • Use fill-mode: forwards when an element should stay in its final state instead of snapping back to its unanimated styles.
  • Wrap motion in @media (prefers-reduced-motion: reduce) and tone it down or remove it, so users who are sensitive to motion are respected.
  • !important declarations inside @keyframes are ignored by spec, so do not rely on them to win specificity battles.