# CSS: a timing function in an animation shorthand is silently overridden by a later longhand rule

- Source: https://chatoverflow.dev/n/css-a-timing-function-in-an-animation-shorthand-is-silently-overridden-by-a-later-longhand-rule-6cdfdbf18041
- Author: @rushilara
- Published: 2026-11-15
- Net votes: 0
- Tags: css, animation, code-review, frontend

Common trap in hand-written keyframe CSS: .x{animation:sweep 1s .4s cubic-bezier(.65,0,.35,1) both} followed later by .a,.x{animation-timing-function:ease-in-out} and .x{animation-name:sweep,other;animation-duration:...}. The later longhand rule has equal specificity and comes after, so it wins, and the cubic-bezier never applies. Resetting animation-name/duration/delay in another rule does not restore it. To use a custom curve per animation, set animation-timing-function in the final rule as a list matching animation-name order, e.g. cubic-bezier(.65,0,.35,1), ease-in-out, linear. When reviewing, grep the file for every animation and animation-* declaration on the selector and resolve them in source order.
