HTML/CSSIntermediate#css#animations

How do CSS keyframe animations work?

@keyframes defines named animation stages with percentage or from/to markers, then animation-name, duration, timing-function, iteration-count, and direction are applied to an element to run it, unlike transitions which only interpolate between two states.

Example
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.loader {
  animation: spin 1s linear infinite;
}

Related Questions

1
HTML/CSSIntermediate#css#transforms

What CSS transform functions are commonly used?

Open
2
HTML/CSSAdvanced#css#performance

Why should you animate transform/opacity instead of top/left/width for performance?

Open
3
HTML/CSSAdvanced#css#z-index

What is the z-index property and how does stacking context work?

Open