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 bytransition-timing-function, animation-timing-function, and the transition and animation shorthands
SupportChrome 4 · Firefox 4 · Safari 3.1
steps() with jump-* keywords: Chrome 77 · Firefox 65 · Safari 14
linear(): Chrome 113 · Firefox 112 · Safari 17.2
Speccss-easing-2
ValueCurve
linearConstant speed.
easecubic-bezier(0.25, 0.1, 0.25, 1): a quick start and a gentle finish. The default.
ease-incubic-bezier(0.42, 0, 1, 1): starts slowly, ends at full speed.
ease-outcubic-bezier(0, 0, 0.58, 1): starts at full speed, slows to a stop.
ease-in-outcubic-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-endsteps(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);
A curve that overshoots slightly before settling.

<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.

DefinitionOne of the predefined range keywords below
Used byanimation-range, animation-range-start, animation-range-end, and keyframe selectors such as entry 50% in @keyframes
SupportChrome 119 · Firefox 159 · Safari 26
scroll: Chrome 147 · Firefox 159 · Safari 26.5
Specscroll-animations-1
RangeRuns from … to …
coverThe element first starting to enter the scrollport, to it having completely left. The whole view timeline.
containThe element being fully inside the scrollport (or fully covering it, if it is bigger), to it starting to leave.
entryThe element starting to enter, to it being fully inside (or fully covering).
exitThe element starting to leave, to it having completely left.
entry-crossingThe element's leading edge crossing the scrollport's end edge, to its trailing edge crossing it.
exit-crossingThe element's leading edge crossing the scrollport's start edge, to its trailing edge crossing it.
scrollThe full scroll range of the scroll container.
.card {
  animation: fade-in linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}
Fade a card in as it scrolls into view, finishing once it is fully visible.

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 bytransition, as a comma-separated list
Speccss-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;
Two transitions; the second starts 50ms later.

Animations

<single-animation-direction>

Whether each cycle of a keyframe animation plays forwards, backwards, or alternates between the two.

Syntaxnormal | reverse | alternate | alternate-reverse
Used byanimation-direction, animation
Speccss-animations-1
ValueCycles play
normalForwards, from 0% to 100%, every time.
reverseBackwards every time; the easing is reversed too.
alternateForwards, then backwards, and so on.
alternate-reverseBackwards, 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.

Syntaxnone | forwards | backwards | both
Used byanimation-fill-mode, animation
Speccss-animations-1
ValueEffect
noneThe animation has no effect outside the time it is running.
forwardsAfter it ends, the element keeps the styles of the last keyframe reached.
backwardsDuring the delay, the element already takes the styles of the first keyframe.
bothforwards 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.

Syntaxinfinite | <number [0,∞]>
Used byanimation-iteration-count, animation
Speccss-animations-1

<single-animation-play-state>

Whether an animation is running or paused. A paused animation holds its current frame and resumes from there.

Syntaxrunning | paused
Used byanimation-play-state, animation
Speccss-animations-1
.spinner:hover { animation-play-state: paused; }
Pause an animation while the pointer is over it.

<single-animation-composition>

How an animation's value combines with the element's underlying value, or with other animations on the same property.

Syntaxreplace | add | accumulate
Used byanimation-composition (Chrome 112 · Firefox 115 · Safari 16), animation
Speccss-animations-2
ValueResult
replaceThe animated value replaces the underlying value. The default.
addThe animated value is added on: for transform, the animation's functions are appended to the element's own list.
accumulateThe 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 bytransform
SupportChrome 1 · Firefox 3.5 · Safari 3.1
3D functions: Chrome 12 · Firefox 10 · Safari 4
Speccss-transforms-2
KindFunctions
Movetranslate(), translateX(), translateY(), translateZ(), translate3d()
Scalescale(), scaleX(), scaleY(), scaleZ(), scale3d()
Rotaterotate(), rotateX(), rotateY(), rotateZ(), rotate3d()
Skewskew(), skewX(), skewY()
Otherperspective(), 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 byfilter, backdrop-filter
SupportChrome 18 · Firefox 35 · Safari 6
Specfilter-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); }
Frosted glass: blur and boost whatever is behind the element.

<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 bybox-shadow; text-shadow uses the same shape without spread or inset
Speccss-backgrounds-3
PartMeaning
First lengthHorizontal offset; positive moves the shadow right.
Second lengthVertical offset; positive moves the shadow down.
Third lengthBlur radius, never negative. 0 gives a sharp edge.
Fourth lengthSpread: grows (or, if negative, shrinks) the shadow before blurring.
<color>The shadow colour. Defaults to currentcolor.
insetDraws 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);
A tight contact shadow layered over a soft, wider one.