Each feature in detail
MDN The animation-range CSS shorthand property is used to set the start and end of an animation's attachment range along its timeline, i.e., where along the timeline an animation will start and end.
Live preview Example from MDN
.animatedElement {
background-color: deeppink;
animation: appear 1ms linear;
animation-timeline: view();
animation-range: entry 10% exit -25%;
}
@keyframes appear {
from {
background-color: rebeccapurple;
opacity: 0;
transform: scaleX(0);
}
to {
background-color: darkturquoise;
opacity: 0.75;
transform: scaleX(0.75);
}
}
:has(:checked) .animatedElement {
animation-fill-mode: both;
}
.animatedElement {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
:has(:checked) .animatedElement {
animation-fill-mode: both;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
@supports not (animation-range: normal) {
body::before {
content: "Your browser does not support the 'animation-range' property.";
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="animatedElement"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
<label>
<input type="checkbox" /> Add <code>animation-fill-mode: both;</code>
</label>
</div>
Syntax
[ <'animation-range-start'> <'animation-range-end'>? ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- see individual properties
- Applies to
- see individual properties
- Inherited
- see individual properties
- Percentages
- see individual properties
- Computed value
- see individual properties
- Canonical order
- per grammar
- Animation type
- see individual properties
- Longhands
animation-range-start, animation-range-end
Browser support
First browser version supporting animation-range | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The animation-range-end CSS property sets the point on the timeline where an animation should end.
Live preview Example from MDN
.animatedElement {
background-color: deeppink;
animation: appear 1ms linear;
animation-timeline: view();
animation-range-end: exit 25%;
}
@keyframes appear {
from {
background-color: rebeccapurple;
opacity: 0;
transform: scaleX(0);
}
to {
background-color: darkturquoise;
opacity: 0.75;
transform: scaleX(0.75);
}
}
:has(:checked) ~ .animatedElement {
animation-fill-mode: forwards;
}
.animatedElement {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
:has(:checked) .animatedElement {
animation-fill-mode: both;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
@supports not (animation-range-end: normal) {
body::before {
content: "Your browser does not support the 'animation-range-end' property.";
color: black;
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="animatedElement"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non tellus
orci ac auctor augue mauris. Risus quis varius quam quisque id diam vel quam
elementum. Nibh praesent tristique magna sit amet purus gravida quis. Duis
ultricies lacus sed turpis tincidunt id aliquet. In egestas erat imperdiet sed
euismod nisi. Eget egestas purus viverra accumsan in nisl nisi scelerisque.
Netus et malesuada fames ac.
</p>
<p>
<label>
<input type="checkbox" /> Add <code>animation-fill-mode: forwards;</code>
</label>
</p>
</div>
Syntax
[ normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- normal
- Applies to
- all elements
- Inherited
- no
- Percentages
- relative to the specified named timeline range if one was specified, else to the entire timeline
- Computed value
- list, each item either the keyword normal or a timeline range and progress percentage
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting animation-range-end | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The animation-range-start CSS property sets the point on the timeline where an animation should start.
Live preview Example from MDN
.animatedElement {
background-color: deeppink;
animation: appear 1ms linear;
animation-timeline: scroll();
animation-range-start: -25%;
}
@keyframes appear {
from {
background-color: rebeccapurple;
opacity: 0;
transform: scaleX(0);
}
to {
background-color: darkturquoise;
opacity: 0.75;
transform: scaleX(0.75);
}
}
.animatedElement {
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
@supports not (animation-range-start: normal) {
body::before {
content: "Your browser does not support the 'animation-range-start' property.";
color: black;
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="animatedElement"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
</div>
Syntax
[ normal | <length-percentage> | <timeline-range-name> <length-percentage>? ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- normal
- Applies to
- all elements
- Inherited
- no
- Percentages
- relative to the specified named timeline range if one was specified, else to the entire timeline
- Computed value
- list, each item either the keyword normal or a timeline range and progress percentage
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting animation-range-start | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The scroll-timeline CSS shorthand property is used to define a named scroll progress timeline, which is progressed through by scrolling a scrollable element (scroller) between top and bottom (or left and right).
Live preview Example from MDN
Syntax
[ <'scroll-timeline-name'> <'scroll-timeline-axis'>? ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- see individual properties
- Applies to
- all elements
- Inherited
- no
- Percentages
- see individual properties
- Computed value
- see individual properties
- Canonical order
- per grammar
- Animation type
- not animatable
- Longhands
scroll-timeline-name, scroll-timeline-axis
Browser support
First browser version supporting scroll-timeline | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The scroll-timeline-axis CSS property is used to specify the scrollbar direction that will be used to provide the timeline for a scroll driven animation, which is progressed through by scrolling a scrollable element (scroller).
Live preview Example from MDN
Syntax
[ block | inline | x | y ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- block
- Applies to
- all elements
- Inherited
- no
- Percentages
- n/a
- Computed value
- a list of the keywords specified
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting scroll-timeline-axis | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The scroll-timeline-name CSS property is used to define the name of a named scroll progress timeline.
Live preview Example from MDN
Syntax
[ none | <dashed-ident> ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- none
- Applies to
- all elements
- Inherited
- no
- Percentages
- n/a
- Computed value
- list, each item either a CSS identifier or the keyword none
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting scroll-timeline-name | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The timeline-scope CSS property modifies the scope of a named animation timeline.
Syntax
none | all | <dashed-ident>#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- none
- Applies to
- all elements
- Inherited
- no
- Percentages
- n/a
- Computed value
- the keyword none, the keyword all, or a list of CSS identifiers
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting timeline-scope | Chrome | 116 |
| Edge | 116 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 116 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The view-timeline CSS shorthand property defines a named view progress timeline's name, direction, and inset values.
Live preview Example from MDN
.subject {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
.animation {
view-timeline: --subject-reveal block;
animation-timeline: --subject-reveal;
animation-name: appear;
animation-fill-mode: both;
animation-duration: 1ms; /* Firefox requires this to apply the animation */
}
@keyframes appear {
from {
opacity: 0;
transform: scaleX(0);
}
to {
opacity: 1;
transform: scaleX(1);
}
}
@layer no-support {
@supports not (view-timeline: none) {
body::before {
content: "Your browser doesn't support the `view-timeline` property.";
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
}
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="subject animation"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
</div>
Syntax
[ <'view-timeline-name'> [ <'view-timeline-axis'> || <'view-timeline-inset'> ]? ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- see individual properties
- Applies to
- all elements
- Inherited
- see individual properties
- Percentages
- see individual properties
- Computed value
- see individual properties
- Canonical order
- per grammar
- Animation type
- see individual properties
- Longhands
view-timeline-name, view-timeline-axis
Browser support
First browser version supporting view-timeline | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The view-timeline-axis CSS property specifies the scroll direction to be used for a named view progress timeline.
Live preview Example from MDN
.subject {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
.content {
width: 50%;
height: 400px;
margin-top: 30px;
display: flex;
flex-flow: column wrap;
gap: 10px;
}
p {
font-family: "Helvetica", "Arial", sans-serif;
}
p {
font-size: 1.3rem;
line-height: 1.4;
}
.animation {
view-timeline-name: --subject-reveal;
view-timeline-axis: x;
view-timeline-axis: horizontal;
animation: appear 1ms linear both;
animation-timeline: --subject-reveal;
}
@keyframes appear {
from {
opacity: 0;
transform: scaleX(0);
}
to {
opacity: 1;
transform: scaleX(1);
}
}
@layer no-support {
body::before {
display: block;
text-align: center;
padding: 1rem 0;
}
@supports not (view-timeline-axis: inherit) {
body::before {
content: "Your browser doesn't support the `view-timeline-axis` property.";
background-color: wheat;
}
}
@supports (view-timeline-axis: horizontal) {
body::before {
content: "Your browser supports legacy values for the `view-timeline-axis` property.";
background-color: yellow;
}
}
}
<div class="content">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</p>
<p>
Risus quis varius quam quisque id. Et ligula ullamcorper malesuada proin
libero nunc consequat interdum varius. Elit ullamcorper dignissim cras
tincidunt lobortis feugiat vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras.
</p>
<p>
A erat nam at lectus urna duis convallis convallis. Nibh ipsum consequat
nisl vel pretium lectus.
</p>
<p>
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="subject animation"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris.
</p>
</div>
Syntax
[ block | inline | x | y ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- block
- Applies to
- all elements
- Inherited
- no
- Percentages
- n/a
- Computed value
- a list of the keywords specified
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting view-timeline-axis | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The view-timeline-inset CSS property is used to specify one or two values representing an adjustment to the position of the scrollport (see Scroll container for more details) in which the subject element of a named view progress timeline animation is deemed to be visible. Put another way, this allows you to specify start and/or end inset (or outset) values that offset the position of the timeline.
Live preview Example from MDN
.subject {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
.animation {
view-timeline: --subject-reveal block;
view-timeline-inset: 70% -100px;
animation-timeline: --subject-reveal;
animation-name: appear;
animation-fill-mode: both;
animation-duration: 1ms; /* Firefox requires this to apply the animation */
}
@keyframes appear {
from {
opacity: 0;
transform: scaleX(0);
}
to {
opacity: 1;
transform: scaleX(1);
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="subject animation"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
</div>
Syntax
[ [ auto | <length-percentage> ]{1,2} ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- auto
- Applies to
- all elements
- Inherited
- no
- Percentages
- relative to the corresponding dimension of the relevant scrollport
- Computed value
- a list consisting of two-value pairs representing the start and end insets each as either the keyword auto or a computed <length-percentage> value
- Canonical order
- per grammar
- Animation type
- by computed value type
Browser support
First browser version supporting view-timeline-inset | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The view-timeline-name CSS property specifies the names of one or more named view progress timelines associated with the element.
Live preview Example from MDN
.subject {
width: 300px;
height: 200px;
margin: 0 auto;
background-color: deeppink;
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p,
h1 {
font-family: "Helvetica", "Arial", sans-serif;
}
h1 {
font-size: 3rem;
}
p {
font-size: 1.5rem;
line-height: 1.5;
}
.animation {
view-timeline-name: --subject-reveal;
animation-timeline: --subject-reveal;
animation-name: appear;
animation-fill-mode: both;
animation-duration: 1ms; /* Firefox requires this to apply the animation */
}
@keyframes appear {
from {
opacity: 0;
transform: scaleX(0);
}
to {
opacity: 1;
transform: scaleX(1);
}
}
@layer no-support {
@supports not (view-timeline-name: none) {
body::before {
content: "Your browser doesn't support the `view-timeline-name` property.";
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
}
}
}
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="subject animation"></div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
</div>
Syntax
[ none | <dashed-ident> ]#
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Definition
- Initial
- none
- Applies to
- all elements
- Inherited
- no
- Percentages
- n/a
- Computed value
- list, each item either a CSS identifier or the keyword none
- Canonical order
- per grammar
- Animation type
- not animatable
Browser support
First browser version supporting view-timeline-name | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
Spec The scroll() functional notation can be used as a <single-animation-timeline> value in animation-timeline and specifies a scroll progress timeline. Its syntax is
MDN The scroll() CSS function can be used with the animation-timeline property to create an anonymous scroll progress timeline, defining the scroller and axis of the timeline.
Live preview Example from MDN
Syntax
scroll( [ <scroller> || <axis> ]? )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting scroll() | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
Spec The view() functional notation can be used as a <single-animation-timeline> value in animation-timeline and specifies a view progress timeline in reference to the nearest ancestor scroll container that’s scrollable in the specified axis. Its syntax is
MDN The view() CSS function is used with the animation-timeline property to create an anonymous view progress timeline based on when an element comes into view inside its nearest scroll container. You can adjust the tracking axis and the optional insets to control when the element is considered "in view".
Live preview Example from MDN
.subject {
width: 300px;
height: 200px;
background-color: deeppink;
}
.subject-container {
border: 2px dashed black;
width: 300px;
margin: 0 auto;
}
.overlay {
position: fixed;
}
.top {
top: 0;
height: 50%;
}
.bottom {
bottom: 0;
height: 10%;
}
.animation {
animation-timeline: view(block 50% 10%);
animation-name: grow;
animation-timing-function: linear;
}
@keyframes grow {
from {
transform: scaleX(0);
}
to {
transform: scaleX(1);
}
}
.content {
width: 75%;
max-width: 800px;
margin: 0 auto;
}
p {
font-size: 1.5rem;
line-height: 1.8;
}
.overlay {
width: 100%;
background-color: #f5deb3aa;
display: flex;
font-size: 1.2rem;
font-weight: bold;
color: red;
justify-content: flex-end;
}
.top {
align-items: end;
}
@layer no-support {
@supports not (animation-timeline: view()) {
body::after {
content: "Your browser doesn't support the CSS `view()` function.";
background-color: wheat;
display: block;
text-align: center;
padding: 1rem 0;
position: absolute;
inset: 0;
bottom: auto;
}
}
}
<div class="subject-container">
<div class="subject animation"></div>
</div>
<div class="content">
<h1>Content</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
vivamus at augue.
</p>
<p>
Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
arcu vitae elementum curabitur vitae nunc sed velit.
</p>
<div class="subject-container">
<div class="subject animation"></div>
</div>
<p>
Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
scelerisque. Netus et malesuada fames ac.
</p>
</div>
<div class="overlay top">inset start 50%</div>
<div class="overlay bottom">inset end 10%</div>
Syntax
view( [ <axis> || <'view-timeline-inset'> ]? )
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Browser support
First browser version supporting view() | Chrome | 115 |
| Edge | 115 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 115 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗
MDN The <axis> enumerated data type specifies the scrolling direction of the scroll container controlling a scroll timeline.
Syntax
block | inline | x | y
Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.
Specification ↗ MDN reference ↗
Spec A named timeline range is a named segment of an animation timeline. The start of the segment is represented as 0% progress through the range; the end of the segment is represented as 100% progress through the range. Multiple named timeline ranges can be associated with a given timeline, and multiple such ranges can overlap. For example, the contain range of a view progress timeline overlaps with its cover range. Named timeline ranges are represented by the <timeline-range-name> value type, which indicates a CSS identifier representing one of the predefined named timeline ranges.
MDN The <timeline-range-name> enumerated data type is a CSS identifier representing one of the predefined named timeline ranges inside a view progress timeline.
Browser support
First browser version supporting <timeline-range-name> | Chrome | 119 |
| Edge | 119 |
| Firefox | 159 |
| Safari | 26 |
| Chrome Android | 119 |
| Safari iOS | 26 |
First version with support, from MDN browser-compat-data.
Specification ↗ MDN reference ↗