Animation & effects values
The value types used by transitions, keyframe and scroll-driven animations, transforms, filters and shadows. The properties are under Transitions & animation, Scroll-driven animation, Transforms and Filters, effects & masking; the individual functions under Transform functions and Filter functions. Durations and delays are <time> values.
Timing
<easing-function>
How progress through a transition or animation maps to change over time: steady, speeding up, slowing down, overshooting, or jumping in steps. It can be a keyword, a cubic-bezier() curve, a steps() staircase, or a linear() function made of straight segments.
| Syntax | <linear-easing-function> | <cubic-bezier-easing-function> | <step-easing-function> |
|---|---|
| Used by | transition-timing-function, animation-timing-function, and the transition and animation shorthands |
| Support | Chrome 4 · Firefox 4 · Safari 3.1steps() with jump-* keywords: Chrome 77 · Firefox 65 · Safari 14linear(): Chrome 113 · Firefox 112 · Safari 17.2 |
| Spec | css-easing-2 |
| Value | Curve |
|---|---|
linear | Constant speed. |
ease | cubic-bezier(0.25, 0.1, 0.25, 1): a quick start and a gentle finish. The default. |
ease-in | cubic-bezier(0.42, 0, 1, 1): starts slowly, ends at full speed. |
ease-out | cubic-bezier(0, 0, 0.58, 1): starts at full speed, slows to a stop. |
ease-in-out | cubic-bezier(0.42, 0, 0.58, 1): slow at both ends. |
cubic-bezier(x1, y1, x2, y2) | A custom curve through two control points. The x values must be between 0 and 1; y values outside that range overshoot. |
steps(n, position) | n equal jumps. The position, jump-start, jump-end (the default), jump-none or jump-both, says where the jumps happen; start and end are older names for the first two. |
step-start, step-end | steps(1, jump-start) and steps(1, jump-end). |
linear(points) | Straight lines between a list of output values, with optional percentage positions. With enough points it can approximate springs and bounces. |
transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
<timeline-range-name>
A named stretch of a scroll-driven timeline, such as the part of a view timeline while an element is entering the scrollport. 0% is the start of the stretch and 100% its end, so an animation can be attached to just that part of the scroll.
| Definition | One of the predefined range keywords below |
|---|---|
| Used by | animation-range, animation-range-start, animation-range-end, and keyframe selectors such as entry 50% in @keyframes |
| Support | Chrome 119 · Firefox 159 · Safari 26scroll: Chrome 147 · Firefox 159 · Safari 26.5 |
| Spec | scroll-animations-1 |
| Range | Runs from … to … |
|---|---|
cover | The element first starting to enter the scrollport, to it having completely left. The whole view timeline. |
contain | The element being fully inside the scrollport (or fully covering it, if it is bigger), to it starting to leave. |
entry | The element starting to enter, to it being fully inside (or fully covering). |
exit | The element starting to leave, to it having completely left. |
entry-crossing | The element's leading edge crossing the scrollport's end edge, to its trailing edge crossing it. |
exit-crossing | The element's leading edge crossing the scrollport's start edge, to its trailing edge crossing it. |
scroll | The full scroll range of the scroll container. |
.card {
animation: fade-in linear both;
animation-timeline: view();
animation-range: entry 0% entry 100%;
}
Transitions
<single-transition>
One transition in the transition shorthand: the property to watch, a duration, an easing function, a delay, and whether discrete properties may transition. The parts can come in any order, but the first time is always the duration and the second the delay.
| Syntax | [ none | <single-transition-property> ] || <time> || <easing-function> || <time> || <transition-behavior-value> |
|---|---|
| Used by | transition, as a comma-separated list |
| Spec | css-transitions-2 |
<single-transition-property> is all or a property name. <transition-behavior-value> is normal or allow-discrete; allow-discrete lets properties such as display and overlay flip at the right moment of a transition (Chrome 117 · Firefox 129 · Safari 17.4).
transition: opacity 200ms ease-out, transform 300ms ease-out 50ms;
Animations
<single-animation-direction>
Whether each cycle of a keyframe animation plays forwards, backwards, or alternates between the two.
| Syntax | normal | reverse | alternate | alternate-reverse |
|---|---|
| Used by | animation-direction, animation |
| Spec | css-animations-1 |
| Value | Cycles play |
|---|---|
normal | Forwards, from 0% to 100%, every time. |
reverse | Backwards every time; the easing is reversed too. |
alternate | Forwards, then backwards, and so on. |
alternate-reverse | Backwards, then forwards, and so on. |
<single-animation-fill-mode>
Whether an animation's keyframe styles apply before it starts (during its delay) and after it ends.
| Syntax | none | forwards | backwards | both |
|---|---|
| Used by | animation-fill-mode, animation |
| Spec | css-animations-1 |
| Value | Effect |
|---|---|
none | The animation has no effect outside the time it is running. |
forwards | After it ends, the element keeps the styles of the last keyframe reached. |
backwards | During the delay, the element already takes the styles of the first keyframe. |
both | forwards and backwards together. |
<single-animation-iteration-count>
How many times an animation's cycle repeats. Fractions are allowed, so 0.5 plays half a cycle and stops.
| Syntax | infinite | <number [0,∞]> |
|---|---|
| Used by | animation-iteration-count, animation |
| Spec | css-animations-1 |
<single-animation-play-state>
Whether an animation is running or paused. A paused animation holds its current frame and resumes from there.
| Syntax | running | paused |
|---|---|
| Used by | animation-play-state, animation |
| Spec | css-animations-1 |
.spinner:hover { animation-play-state: paused; }
<single-animation-composition>
How an animation's value combines with the element's underlying value, or with other animations on the same property.
| Syntax | replace | add | accumulate |
|---|---|
| Used by | animation-composition (Chrome 112 · Firefox 115 · Safari 16), animation |
| Spec | css-animations-2 |
| Value | Result |
|---|---|
replace | The animated value replaces the underlying value. The default. |
add | The animated value is added on: for transform, the animation's functions are appended to the element's own list. |
accumulate | The values are combined: for transform, matching functions merge, so translateX(10px) and translateX(20px) give translateX(30px). |
Transforms, filters & shadows
<transform-function>
One step of a transform: a move, scale, rotation, skew, perspective or matrix. A transform value is a list of these. Order matters, because each function works in the coordinate system left by the ones before it: translate(100px) rotate(45deg) and rotate(45deg) translate(100px) put the box in different places.
| Syntax | <scale3d()> | <scale()> | <scaleX()> | <scaleY()> | <scaleZ()> | <translate3d()> | <translate()> | <translateX()> | <translateY()> | <translateZ()> | <rotate3d()> | <rotate()> | <rotateX()> | <rotateY()> | <rotateZ()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <matrix()> | <perspective()> |
|---|---|
| Used by | transform |
| Support | Chrome 1 · Firefox 3.5 · Safari 3.1 3D functions: Chrome 12 · Firefox 10 · Safari 4 |
| Spec | css-transforms-2 |
| Kind | Functions |
|---|---|
| Move | translate(), translateX(), translateY(), translateZ(), translate3d() |
| Scale | scale(), scaleX(), scaleY(), scaleZ(), scale3d() |
| Rotate | rotate(), rotateX(), rotateY(), rotateZ(), rotate3d() |
| Skew | skew(), skewX(), skewY() |
| Other | perspective(), matrix(), matrix3d() |
Each function is described under Transform functions. For a single move, scale or rotation, the separate translate, scale and rotate properties are simpler and can be animated independently.
<filter-function>
A graphical effect applied to an element's rendering, such as a blur or a colour shift. A filter value is a list of these, applied in order.
| Syntax | <blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <sepia()> | <saturate()> |
|---|---|
| Used by | filter, backdrop-filter |
| Support | Chrome 18 · Firefox 35 · Safari 6 |
| Spec | filter-effects-1 |
Each function is described under Filter functions. A filter list can also include url() references to SVG <filter> elements. Unlike box-shadow, drop-shadow() follows the shape of the element's visible pixels, so the transparent parts of an image cast no shadow.
.glass { backdrop-filter: blur(12px) saturate(1.4); }
<shadow>
One shadow: two offsets, an optional blur radius, an optional spread distance, an optional colour, and the inset keyword to draw the shadow inside the box instead of outside. A shadow property takes a comma-separated list; the first shadow is drawn on top.
| Syntax | <color>? && [ <length>{2} [ <length [0,∞]> <length>? ]? ] && inset? |
|---|---|
| Used by | box-shadow; text-shadow uses the same shape without spread or inset |
| Spec | css-backgrounds-3 |
| Part | Meaning |
|---|---|
| First length | Horizontal offset; positive moves the shadow right. |
| Second length | Vertical offset; positive moves the shadow down. |
| Third length | Blur radius, never negative. 0 gives a sharp edge. |
| Fourth length | Spread: grows (or, if negative, shrinks) the shadow before blurring. |
<color> | The shadow colour. Defaults to currentcolor. |
inset | Draws the shadow inside the padding box, as if the box were sunk into the page. |
box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 8px 24px -4px rgb(0 0 0 / 0.15);