{"id":197380,"date":"2015-03-05T11:50:21","date_gmt":"2015-03-05T18:50:21","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=197380"},"modified":"2021-07-14T11:58:12","modified_gmt":"2021-07-14T18:58:12","slug":"will-change","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/w\/will-change\/","title":{"rendered":"will-change"},"content":{"rendered":"\n
The This property has four values:<\/p>\n\n\n\n We can inform the browser that a change is about to take place to the Or if we want to declare multiple values we can use a comma-separated list such as:<\/p>\n\n\n\n It’s important not to overuse the This browser support data is from Caniuse<\/a>, which has more detail. A number indicates that browser supports the feature at that version and up.<\/p><\/div>will-change<\/code> property in CSS optimizes animations by letting the browser know which properties and elements are just about to be manipulated, potentially increasing the performance of that particular operation.<\/p>\n\n\n
Syntax<\/h3>\n\n\n
will-change: <animateable-feature> = scroll-position | contents | <custom-ident><\/code><\/pre>\n\n\n\n
auto<\/code><\/li>
Values<\/h3>\n\n\n
auto<\/code>: standard browser optimizations will be applied.<\/li>
scroll-position<\/code>: indicates that the element\u2019s scroll position will be animated sometime in the near future so the browser will prepare for content which is not visible in the scroll window of an element.<\/li>
contents<\/code>: the contents of an element is expected to change so the browser will not cache this element\u2019s content.<\/li>
<custom-ident><\/code>: any user-defined property such as
transform<\/code> or
opacity<\/code> that we want
will-change<\/code> to be applied to.<\/li><\/ul>\n\n\n
Using the property<\/h3>\n\n\n
transform<\/code> property like so:<\/p>\n\n\n\n
.element {\n will-change: transform;\n}<\/code><\/pre>\n\n\n\n
.element {\n will-change: transform, opacity;\n}<\/code><\/pre>\n\n\n\n
will-change<\/code> property however since it might, in fact, cause the page to be less performant (note that there is not an
all<\/code> value for this property for a good reason). As a result, MDN recommends<\/a> that the property be used as a last resort for existing performance issues rather than ones you anticipate could happen. And, when using it, it’s recommended to toggle
will-change<\/code> just before an element or property changes and then toggle it off again shortly after the process is finished.<\/p>\n\n\n
Other resources<\/h3>\n\n\n
will-change<\/code> on MDN<\/a><\/li>
will-change<\/code> on W3C<\/a><\/li>
Browser support<\/h3>\n\n
Desktop<\/h4>
Chrome<\/span><\/th> Firefox<\/span><\/th> IE<\/span><\/th> Edge<\/span><\/th> Safari<\/span><\/th><\/tr><\/thead> 36<\/span><\/td> 36<\/span><\/td> No<\/span><\/td> 79<\/span><\/td> 9.1<\/span><\/td><\/tr><\/table><\/div> Mobile \/ Tablet<\/h4>
Android Chrome<\/span><\/th> Android Firefox<\/span><\/th> Android<\/span><\/th> iOS Safari<\/span><\/th><\/tr><\/thead> 124<\/span><\/td> 125<\/span><\/td> 124<\/span><\/td> 9.3<\/span><\/td><\/tr><\/table><\/div><\/div>\n\n\n Specification<\/h3>\n\n\n
will-change<\/code> is defined in the CSS Will Change Module Level 1<\/a> specification, which is currently in Editor’s Draft status. This means the information provided here and in the specification could change before it reaches candidate recommendation.<\/p>\n\n\n
Related properties<\/h3>\n\n\n \t\t\n