Should I transition all CSS properties or name only the ones that change?
Quick answer
Name the properties you intend to animate in most cases. An explicit list makes the effect easier to understand and prevents unrelated property changes from joining the transition. Use all only when you deliberately want every changed property that can transition to receive the same treatment. Neither choice is automatically faster: performance depends on which properties actually change and the rendered workload.
The question, the details, the next step.
A practical checklist
Compare the component’s resting and interactive states.
Write down only the properties intended to animate.
Use an explicit property list unless every changed property should share the transition.
Give properties separate timing when their intended effects differ.
Review layout-related properties deliberately; rendering cost depends on the actual workload.
After a style change, check that no newly changed property animates by accident.
A few more useful answers
Can I combine `all` with a named property?
Yes. MDN notes that a later named transition can override an earlier all entry for that property. Still, an explicit list may be easier to read when you want only selected properties to animate. [S1]
Does naming properties guarantee better animation performance?
No. Naming helps control which properties transition, but it does not by itself establish rendering performance. The properties that change and the page’s workload matter. [S2]
What if I cannot tell whether a property should animate?
Compare the component before and after the state change. If animating that difference is not an intentional part of the interaction, leave it out of the transition list and check the result in context.
Sources
References used for this guide.
- [S1] MDN: transition CSS property developer.mozilla.org · Checked
- [S2] MDN: CSS performance optimization and animated properties developer.mozilla.org · Checked
