Defines what values are applied by the animation outside the time it is executing (before and after the animation).
By default, an animation does not affect property values between the time it is applied (when the animation-name property is set on an element) and the time it begins execution (determined by the animation-delay property). Also, by default an animation does not affect property values after the animation ends (determined by the animation-duration property). The animation-fill-mode property can override this behavior.
Overview tablenone
animation-fill-mode: backwards
animation-fill-mode: both
animation-fill-mode: forwards
animation-fill-mode: none
An example of a mobile-like interface in which two concurrent animations displace content with a banner header. Without any animations, both elements would overlay the same screen area. In the moveContent animation, the fill mode of forwards means its end state (moved downward) persists after it finishes executing. In the insertBanner animation, the fill mode of backwards means its start state (off-screen) takes precedence over the element’s CSS during the delay before the animation executes. (In the subsequent scrollBanner animation, the fill-mode is explicitly set to none to keep its initial state from overriding that of the previous animation.)
article {
animation-name : moveContent;
animation-duration : 1s;
animation-delay : 4s;
animation-iteration-count : 1;
animation-fill-mode : forwards;
}
header {
animation-name : insertBanner , scrollBanner;
animation-duration : 1s , 20s;
animation-delay : 4s , 5s;
animation-fill-mode : backwards , none;
animation-iteration-count : 1 , infinite;
}
@keyframes moveContent {
from { transform : translateY(0em) }
to { transform : translateY(3em) }
}
@keyframes insertBanner {
from { transform : translateY(-6em) }
to { transform : translateY(0em) }
}
@keyframes scrollBanner {
from { transform : translateX(0) }
17% { transform : translateX(0%) }
20% { transform : translateX(-20%) }
37% { transform : translateX(-20%) }
40% { transform : translateX(-40%) }
57% { transform : translateX(-40%) }
60% { transform : translateX(-60%) }
77% { transform : translateX(-60%) }
80% { transform : translateX(-80%) }
97% { transform : translateX(-80%) }
to { transform : translateX(0%) }
}
Usage
Can also be a comma-separated list of fill modes, e.g., forwards, none, backwards, where each fill mode is applied to the corresponding ordinal position value of the animation-name property.
Notes
This is an experimental specification, and therefore not completely finalized. Syntax and behavior are still subject to change in future versions.
Related specificationsMozilla Developer Network : Article
Microsoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4