CSS animation
Changing an element's styles smoothly over time using @keyframes and the animation property, without JavaScript.
In more detail
Animations can run on their own, loop and have several steps. For smoothness animate only transform and opacity, which the compositor handles, and respect prefers-reduced-motion.
Related terms
- keyframe — One snapshot of styles at a point in an animation, such as fully transparent at the start and fully visible at the end.
- CSS transition — A CSS feature that animates a property smoothly from one value to another over a set time when it changes.
- compositing — The final rendering stage, in which separately painted layers are stacked and drawn together on screen, usually by the GPU.
- prefers-reduced-motion — The CSS media feature that reports whether the user has asked their operating system to minimise animation.
- CSS — The language that describes how web pages look: colours, fonts, spacing, layout and animation.
- template.tsx — A special file like layout.tsx that wraps its children but is created fresh on every navigation, so its state resets.
Taught in
- Modern CSS Animations, Transitions And View Transitions API — Frontend Architecture & Web Platform
- Templates vs Layouts: Remounting & Page Transitions — Next.js 15 & Modern App Router Architecture