DEV Community

Discussion on: My New Favorite CSS Trick: will-change

Collapse
 
dagnelies profile image
Arnaud Dagnelies • Edited

I never used that. I wonder how much difference it makes in practice. Also, if I understand it right after digging into it a bit, applying it on too many elements may hurt performance. Since it's difficult to estimate the benefit / cost, it's quite tricky to use.

Collapse
 
highflyer910 profile image
Thea • Edited

You're right - will-change needs to be used carefully. Applying it carelessly can hurt performance more than help.

The key is using it only on elements with complex animations. Using it too much or leaving it on when not needed can slow things down.

In practice, will-change can greatly improve animation performance for elements that move, change transparency, or reposition a lot. You'll notice the biggest improvements on less powerful devices or when many animated elements are on the screen at once.

I'd recommend using will-change only on the specific elements being animated. That way, you get the performance benefits while avoiding potential slowdowns.
Thanks for bringing up this point!