Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Functions

The steps() function

Reference for the CSS steps() function: jumping between a number of discrete values, jump-start, jump-end, jump-none, jump-both, sprites and live examples.

The steps() function is an easing function that moves a value in discrete jumps instead of smoothly. It splits the duration into equal intervals and holds a constant value during each one. It is the tool for sprite-sheet animation, ticking clocks, progress indicators and typewriter effects.

CSS
.sprite {
  animation: walk 800ms steps(6) infinite;
}

Try it

Smooth versus stepped
A typewriter effect

Syntax

CSS
steps( <count> [, <jump-term>]? )

/* <jump-term>: jump-start | jump-end | jump-none | jump-both | start | end */
  • Where it works: animation-timing-function, transition-timing-function and their shorthands.
  • Default jump term: jump-end.
  • Inherited: not applicable. Animatable: no.

Values

Argument Description
count A positive integer: how many intervals the duration is divided into.
jump-end (or end) The jump happens at the end of each interval. The first value is shown from the start, the final value only at the very end.
jump-start (or start) The jump happens at the start of each interval. The final value is reached after the last-but-one interval and held.
jump-none No jump at start or end, so both the first and last values are held for a full interval. Needs a count of at least 2.
jump-both Jumps at both start and end, so there are count + 1 distinct values and neither extreme is shown for a full interval.

Two keywords are shortcuts: step-start is steps(1, jump-start) and step-end is steps(1, jump-end).

Usage notes

  • Sprite animation. Put all frames in one wide image, show one frame through a fixed-size window, and animate background-position by the full sheet width with steps(frameCount).
  • Match the count to your content. The count must equal the number of frames (or characters) you want; one too many or too few leaves a gap or a stutter.
  • Easing per keyframe. Inside @keyframes, the timing function applies to the interval after that keyframe, so you can mix smooth and stepped parts.
  • Use animation-timing-function for the whole run, but note that with animation-direction: alternate the easing is reversed on the way back, which turns jump-end into jump-start.
  • Accessibility. Fast flicker is hard on some people; respect prefers-reduced-motion for decorative stepped animations.

Browser support

Supported in all browsers; the jump-* keywords are newer spellings, so use start and end if you need very old browsers.