Home / Companies / LogRocket / Blog / Post Details
Content Deep Dive

When and how to use CSS will-change

Blog post from LogRocket

Post Details
Company
Date Published
Author
Timonwa Akintokun
Word Count
1,879
Language
-
Hacker News Points
-
Summary

The will-change CSS property is designed to improve webpage performance by informing the browser about elements that are likely to change soon, allowing for optimized rendering. This can enhance the fluidity of animations and prevent costly operations like repaints and reflows. However, developers should apply will-change judiciously, as excessive use can degrade performance rather than enhance it. It is particularly useful in scenarios such as animations or when an element's size or position is expected to change, but should be avoided during active animations or transitions and on non-animatable properties. The property is supported in most modern browsers, including Chrome, Firefox, Safari, and Edge, but may be ignored by the browser if deemed unnecessary. Understanding how and when to use will-change can help developers optimize their websites effectively, though caution is advised to prevent resource strain.