monks/will_change

The will-change CSS property hints to browsers how an element is expected to change. Browsers may set up optimizations before an element is actually changed. These kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required.

will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. It should not be used to anticipate performance problems.

Proper usage of this property can be a bit tricky:

Values

pub const auto_: #(String, String)
  • : This keyword expresses no particular intent; the user agent should apply whatever heuristics and optimizations it normally does.The <animatable-feature> can be one of the following values:
pub const contents: #(String, String)
  • : Indicates that the author expects to animate or change something about the element’s contents in the near future.
pub const inherit: #(String, String)
pub const initial: #(String, String)
pub fn raw(value: String) -> #(String, String)

Enter a raw string value for will-change

pub const revert: #(String, String)
pub const revert_layer: #(String, String)
pub const scroll_position: #(String, String)
  • : Indicates that the author expects to animate or change the scroll position of the element in the near future.
pub const unset: #(String, String)
pub fn var(variable: String) -> #(String, String)

Enter a variable name to be used for will-change. It will be wrapped in var() and have -- prepended.

Search Document