CSS animation-range-start Property
The animation-range-start property specifies where an animation's attachment range begins along a scroll-driven animation timeline.
It works with animation-range-end to define the portion of a scroll or view timeline used by an animation. You can specify a percentage, length, or named timeline range to control when an animation begins progressing through its keyframes.
animation-range-start Syntax
selector {
animation-range-start: entry 25%;
}
The value identifies the starting attachment point along the associated animation timeline.
.default-start {
animation-range-start: normal;
}
.percentage-start {
animation-range-start: 20%;
}
.entry-start {
animation-range-start: entry 0%;
}
.cover-start {
animation-range-start: cover 25%;
}
.exit-start {
animation-range-start: exit 50%;
}
For multiple animations, specify a comma-separated list of starting attachment points.
.multiple {
animation-range-start: entry 0%, cover 25%;
}
The property also accepts the global CSS values inherit, initial, revert, revert-layer, and unset.
Property Values
| Value | Description |
|---|---|
normal |
Uses the normal starting boundary of the associated animation timeline. This is the initial value. |
20% |
Sets the starting attachment point at 20% of the associated timeline. |
100px |
Specifies a starting position using a CSS length. |
cover 25% |
Starts one-quarter of the way through the view timeline's cover range. |
contain 0% |
Starts at the beginning of the contain range. |
entry 0% |
Starts when the entry range begins. |
exit 50% |
Starts halfway through the exit range. |
entry-crossing 25% |
Starts one-quarter of the way through the entry-crossing range. |
exit-crossing 0% |
Starts at the beginning of the exit-crossing range. |
The property accepts normal, a <length-percentage> value, or a named timeline range with an optional offset.
When a named range is specified without an offset, its starting position defaults to 0%.
The property applies to all elements, is not inherited, and has an initial value of normal. Its computed value retains the specified range information, with lengths resolved according to CSS computed-value rules.
The animation-range-start property itself is not animatable.
How animation-range-start Works
Scroll-driven animations progress according to a scroll or view timeline instead of relying only on elapsed time.
The animation-range-start property identifies the point where the animation's attachment range begins. Together with animation-range-end, it establishes the interval used to map timeline progress to animation progress.
@keyframes reveal {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.reveal-box {
animation-name: reveal;
animation-duration: auto;
animation-timing-function: linear;
animation-fill-mode: both;
animation-timeline: view();
animation-range-start: entry 25%;
animation-range-end: entry 100%;
}
In supporting browsers, the animation begins progressing when the element reaches 25% of its entry range and reaches its final keyframe at the end of that range.
Changing the starting point to entry 0% makes the animation begin earlier, while entry 50% delays its progress until halfway through the entry range.
The animation-fill-mode: both declaration allows the starting keyframe effect to apply before the attachment range begins and the ending effect to remain after it finishes.
Named Timeline Ranges
View timelines provide named ranges describing the subject's position as it moves through the viewing area of a scroll container.
cover
The cover range extends from when the subject first enters the viewing area until it has completely left.
.box {
animation-range-start: cover 20%;
}
This starts the attachment range 20% of the way through the cover interval.
contain
The contain range represents the interval when the subject is fully contained within the viewing area. For subjects larger than the viewing area, it represents the interval when the viewing area is fully covered by the subject.
.box {
animation-range-start: contain 0%;
}
entry
The entry range describes the subject entering the viewing area.
.box {
animation-range-start: entry 50%;
}
The attachment range begins halfway through the subject's entry interval.
exit
The exit range describes the subject leaving the viewing area.
.box {
animation-range-start: exit 0%;
}
The attachment range begins at the start of the subject's exit interval.
entry-crossing and exit-crossing
The entry-crossing and exit-crossing ranges track the subject's leading and trailing edges crossing the viewing area.
.first-box {
animation-range-start: entry-crossing 25%;
}
.second-box {
animation-range-start: exit-crossing 0%;
}
These ranges provide additional control when the subject is larger than the viewing area and the entry or exit phases differ from the edge-crossing intervals.
Percentages and Lengths
Percentages and lengths allow you to select more precise starting attachment points.
Percentage Values
.box {
animation-range-start: 30%;
}
This places the start of the attachment range at 30% of the associated timeline.
When a percentage follows a named range, it is measured relative to that named range rather than the entire timeline.
.box {
animation-range-start: entry 30%;
}
This begins the attachment range 30% of the way through the entry interval.
Length Values
.box {
animation-range-start: 100px;
}
A length specifies a position along the timeline in CSS length units. The corresponding scroll position depends on the timeline's geometry.
Percentages are often more adaptable than fixed lengths when the viewport size or scrollable content changes.
Named Range Without an Offset
.box {
animation-range-start: entry;
}
For animation-range-start, this is equivalent to entry 0%. Omitting the offset selects the beginning of the named range.
Combining Start and End Positions
Use animation-range-start with animation-range-end to define both boundaries of an animation's attachment range.
.box {
animation-range-start: entry 0%;
animation-range-end: entry 100%;
}
This animation progresses throughout the complete entry range.
Starting Later
.box {
animation-range-start: entry 50%;
animation-range-end: entry 100%;
}
Here, the animation does not begin progressing until halfway through the entry range. It then reaches its final keyframe by the end of that range.
Using a Longer Attachment Range
.box {
animation-range-start: entry 25%;
animation-range-end: exit 75%;
}
This animation starts during the entry phase and continues through most of the subject's passage across the viewing area.
Using a Portion of the Cover Range
.box {
animation-range-start: cover 20%;
animation-range-end: cover 80%;
}
The animation progresses between 20% and 80% of the cover range.
Changing the start without changing the end affects how much timeline progress is available for the animation. A later start generally makes the same keyframe progression occur over a shorter scrolling interval.
Scroll and View Timelines
The animation-range-start property works with scroll progress timelines and view progress timelines.
Scroll Progress Timelines
A scroll progress timeline follows the scroll position of a scroll container.
.progress-bar {
transform-origin: left;
animation: grow linear both;
animation-timeline: scroll();
animation-range-start: 20%;
animation-range-end: 100%;
}
@keyframes grow {
from {
transform: scaleX(0);
}
to {
transform: scaleX(1);
}
}
The progress bar begins progressing when the scroll timeline reaches 20% and reaches full width at 100%.
View Progress Timelines
A view progress timeline follows the position of a subject as it moves through the viewing area.
.reveal-box {
animation: reveal linear both;
animation-timeline: view();
animation-range-start: entry 25%;
animation-range-end: entry 100%;
}
This animation begins one-quarter of the way through the entry interval and finishes at the end of that interval.
Named ranges such as entry, exit, and cover are associated with view timelines. Percentages are commonly used to select positions along scroll progress timelines.
Multiple Animation Start Ranges
An element can have multiple animations, each with a different starting attachment point.
.animated-element {
animation-name: fade-in, slide-in;
animation-duration: auto;
animation-timing-function: linear;
animation-fill-mode: both;
animation-timeline: view(), view();
animation-range-start: entry 0%, cover 25%;
animation-range-end: entry 100%, cover 75%;
}
The fade-in animation begins at the start of the entry range. The slide-in animation begins at 25% of the cover range.
Starting attachment points are matched to animations in the order specified by animation-name.
If fewer start values are provided than animations, the list repeats as needed when matching the values to animations.
.three-animations {
animation-name: fade, move, rotate;
animation-timeline: view(), view(), view();
animation-range-start: entry 0%, cover 25%;
}
Here, fade begins at entry 0%, move begins at cover 25%, and rotate begins at entry 0%.
Keep animation names, timelines, and attachment ranges in a consistent order to make multiple animations easier to maintain.
animation-range-start Example
The following example compares two starting attachment points. Scroll inside the demonstration to see how the squares respond as their sections enter the viewing area.
The first square starts at entry 0%, while the second starts later at entry 50%. Both finish at exit 0%.
<div class="range-start-demo" tabindex="0" aria-label="Scrollable animation range start demonstration">
<div class="range-start-spacer">Scroll down to view the animations</div>
<div class="range-start-item">
<strong>entry 0%</strong>
<div class="range-start-box early"></div>
</div>
<div class="range-start-spacer">Continue scrolling</div>
<div class="range-start-item">
<strong>entry 50%</strong>
<div class="range-start-box late"></div>
</div>
<div class="range-start-spacer">End of example</div>
</div>
.range-start-demo {
height: 250px;
overflow-y: auto;
border: 1px solid #ccc;
background-color: #f8f9fa;
}
.range-start-spacer {
min-height: 220px;
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
box-sizing: border-box;
color: #555;
text-align: center;
}
.range-start-item {
min-height: 120px;
padding: 15px;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
background-color: #fff;
}
.range-start-item strong {
display: block;
margin-bottom: 12px;
}
.range-start-box {
width: 50px;
height: 50px;
background-color: #1769aa;
}
@keyframes range-start-reveal {
from {
opacity: 0.3;
transform: translateX(0);
}
to {
opacity: 1;
transform: translateX(100px);
}
}
@supports (animation-timeline: view()) and (animation-range-start: entry 50%) {
.range-start-box {
animation-name: range-start-reveal;
animation-duration: auto;
animation-timing-function: linear;
animation-fill-mode: both;
animation-timeline: view();
animation-range-end: exit 0%;
}
.range-start-box.early {
animation-range-start: entry 0%;
}
.range-start-box.late {
animation-range-start: entry 50%;
}
}
@media (prefers-reduced-motion: reduce) {
.range-start-box {
animation: none;
}
}
Both squares use the same keyframes and ending attachment point. Only their starting attachment points differ.
The first square begins moving as its subject enters the viewing area. The second waits until halfway through its entry range before beginning to move.
Both animations reach their final keyframes at the beginning of their exit ranges. The second square therefore completes the same movement over a shorter scrolling interval.
The animation-fill-mode: both declaration retains the appropriate keyframe effects outside the active attachment range.
In browsers without the required scroll-driven animation support, the squares remain visible and stationary. They also remain stationary when reduced motion is enabled.
Using the animation-range Shorthand
The animation-range shorthand combines animation-range-start and animation-range-end.
For example, these declarations:
.box {
animation-range-start: entry 25%;
animation-range-end: exit 75%;
}
Can be written as:
.box {
animation-range: entry 25% exit 75%;
}
Use the shorthand when setting both boundaries together. Use animation-range-start when only the starting boundary needs to change.
Declaration order matters when combining the shorthand and longhand properties.
.box {
animation-range: entry 0% exit 100%;
animation-range-start: entry 50%;
}
The final starting attachment point is entry 50% because the longhand declaration appears after the shorthand.
The general animation shorthand does not set animation-range-start, but it resets animation-timeline to auto. Place animation-timeline after the animation shorthand.
Important Considerations
Keep the following points in mind when using animation-range-start:
- Default value: The initial value is
normal, which uses the normal starting boundary of the associated timeline. - Timeline selection: Use
animation-timelineto select the scroll or view timeline that drives the animation. - Named ranges: Values such as
entry,exit, andcoveridentify phases of a view timeline. - Default named offset: A named range without an explicit offset uses its
0%boundary foranimation-range-start. - Percentages: Percentages following a named range are measured relative to that range, not necessarily the complete timeline.
- Start and end: Combine this property with
animation-range-endto establish the complete attachment interval. - Multiple animations: Comma-separated starting positions are matched to animations in their listed order.
- Browser compatibility: Scroll-driven animations have more limited browser support than traditional time-based CSS animations.
- Accessibility: Respect
prefers-reduced-motionand ensure content remains usable when animation support is unavailable.
Use animation-range-start when an animation should begin progressing at a specific point during scrolling, such as after an element has partially entered the viewport.
Browser Support
The animation-range-start property has Limited availability and is not supported consistently across all major browsers.
Support depends on the browser's implementation of scroll-driven animations and their attachment ranges. Support for traditional CSS keyframe animations does not guarantee support for this property.
Use @supports to apply scroll-driven animation behavior only when the necessary features are available.
@supports (animation-timeline: view()) and (animation-range-start: entry 25%) {
.box {
animation: reveal linear both;
animation-timeline: view();
animation-range-start: entry 25%;
animation-range-end: entry 100%;
}
}
Visit Can I Use? to check current browser compatibility.
Specifications
The animation-range-start property is defined in the CSS Scroll-Driven Animations Level 1 specification.
