Increasing Animation Performance Using the will-change Property
suggest changewill-change is a property, not an HTML attribute. It hints that a property is about to change so the browser can prepare. It does not itself animate anything, and it does not make every animation run on the GPU. In practice, transform and opacity are the properties most often promoted to their own layer; animating layout properties such as width or top can still cause layout work.
The value is a comma-separated list of properties. If an element will be transformed and faded, you can write:
.example {
will-change: transform, opacity;
}
Use will-change sparingly, and only just before the change when you can. Setting it on every element can waste memory, because the browser may keep extra layers around. Remove the hint when the change is finished if it was applied from script.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents