The @keyframes at-rule defines the steps of a CSS animation. You name a keyframe list and set styles at points along the timeline, then attach that name with animation-name (or the animation shorthand).
Use from/to for a simple start and end, or percentages for middle steps. Prefer animating transform and opacity for smooth, efficient motion.
Baseline Widely available.
Standard CSS Animations feature since 2015. Keyframe names are case-sensitive and must match animation-name exactly.
Accessibility.
Respect prefers-reduced-motion — reduce or turn off continuous motion when users request less animation.
Syntax
CSS Syntax
syntax.css
@keyframes <keyframes-name> {
from | <percentage> { /* styles */ }
to | <percentage> { /* styles */ }
}
/* then attach the name */
.element {
animation-name: <keyframes-name>;
animation-duration: <time>;
}
from = 0%, to = 100%. You can list offsets in any order.
Offsets:from/to or percentages along the timeline.
Best props: prefer transform and opacity.
Tip: always set a duration, and respect reduced motion.
One line:@keyframes names the steps; animation-name + duration play them.
Frequently Asked Questions
It defines the steps of a CSS animation. You name the keyframe list, set styles at points along the timeline, then connect that name with animation-name or the animation shorthand.
from means 0% (start) and to means 100% (end). Use percentages when you need middle steps such as 25%, 50%, or 75%.
No. If several @keyframes share the same name, the last one in the CSS wins. Animations do not merge keyframes from multiple rules.
No. Declarations with !important inside @keyframes are ignored.
Prefer transform and opacity for smooth, efficient motion. Layout properties like width or margin can work but are often costlier.
It is Baseline and widely available since 2015 in Chrome, Firefox, Safari, Edge, and Opera. It is a browser CSS feature, not a Node.js API.