CSS <timeline-range-name> Data Type
The <timeline-range-name> data type names a phase of a view timeline, such as cover, contain, entry or exit, used to set the range of a scroll-driven animation.
Description
The <timeline-range-name> CSS data type names a phase of a view progress timeline, the timeline that tracks an element as it scrolls into and out of view. It is used in scroll-driven animations by animation-range, animation-range-start and animation-range-end, and in keyframe selectors such as entry 50%, to say during which part of that journey an animation should run.
There are six names. cover is the whole journey, from the moment the element starts to enter the scrollport until it has completely left. contain is the part where the element is fully visible (or, if it is larger than the scrollport, where it fully covers it). entry is the phase in which the element is entering, and exit the phase in which it is leaving. entry-crossing and exit-crossing measure the element crossing the start and end edges of the scrollport, which differs from entry and exit when the element is taller than the scrollport.
Each name is usually followed by a percentage or length that gives a point within the phase, so entry 0% is the moment the element first appears and entry 100% is the moment it has fully entered. If the percentage is left out, the start of the range defaults to 0% and the end to 100%.
Examples:
/* Fade cards in while they enter the viewport */
.card {
animation: fade-in linear both;
animation-timeline: view();
animation-range: entry 0% entry 100%;
}
/* Run only while the element is fully visible */
.parallax {
animation-timeline: view();
animation-range: contain;
}
/* Phase names inside keyframes */
@keyframes reveal {
entry 0% { opacity: 0; }
entry 100% { opacity: 1; }
exit 100% { opacity: 0; }
}
Interactive Demo
Scroll down
Keep scrolling
Syntax
<timeline-range-name> = cover | contain | entry | exit | entry-crossing | exit-crossing
Values
- coverThe full range: from when the element starts entering the scrollport to when it has completely left.
- containThe range in which the element is fully inside the scrollport (or fully covers it, if it is larger).
- entryThe range in which the element is entering the scrollport.
- exitThe range in which the element is leaving the scrollport.
- entry-crossingThe range in which the element crosses the end edge of the scrollport, where it enters.
- exit-crossingThe range in which the element crosses the start edge of the scrollport, where it leaves.
Example
Browser Support
The following information will show you the current browser support for the CSS timeline-range-name data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





