Steps() - CSS Function

steps()

Summary of characteristics of the steps() function

Quick description
This is an easing function, which defines a jerky progression, step by step.
Status
Standard
Percentages
Not applicable.
Per grammar: serialization in the order of syntax.
W3C Module
CSS Easing Functions
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: CR (Candidate Recommendation)

Syntax diagram of steps().

Steps() function - Syntax diagramSyntax diagram of the steps() CSS function. Defines thresholds as a easing function. integer integer jump-start jump-start jump-end jump-end jump-none jump-none jump-both jump-both start start end end step-start step-start step-end step-endsteps()steps()
Syntax diagram of the steps() function.
Click on the terms of the diagram for more precision.
Download the diagram in SVG.

On the diagram, the terms in bold are the predefined terms in CSS, the others are described below:

  • integer is an integer greater than 1.

Description of the steps() function.

The function steps() defines a jerky progression for animations or transitions.

The steps() value can be used with the following properties:

Syntaxes of the steps() function.

  • animation-timing-function: steps(5, start); n m

    n is the number of steps. It's an integer greater than or equal to 0, unless it is followed by jump-none, in which case it must be greater than 1.

    m is a parameter that specifies the behavior of the animation on the first and last steps. This parameter also affects how the animation is resumed when it runs multiple times in a row.
    When this parameter is omitted, it defaults to end.

    The animations or transitions following steps() are a series of jumps and pauses, as you can see in the diagrams below. The m parameter determines whether the progression starts with a pause or a jump, and how it ends.

    The following values are accepted. The default value is end.

    start or jump-start.

    The first jump happens right at the beginning of the animation, and it ends with a platter. Each platter has a duration that is calculated as follows.

    Calculating the duration of a step with the jump-start value Duration of a step = Animation duration Number of steps

    The steps() function

    end ou jump-end

    The last jump happens at the end of the planned animation time.

    Calculating the duration of a step with the jump-end value Duration of a step = Animation duration Number of steps

    The steps() function

    jump-both

    There's a jump right at the start of the animation and another at the end. As a result, there's one less step, and each step lasts a bit longer than in the previous two cases.

    Calculating the duration of a step with the jump-both value Duration of a step = Animation duration Number of steps - 1

    The steps() function

    jump-none

    The animation starts and ends with a platter. There is one more platter than the specified n. The duration of each step is calculated using the formula:

    Duration of a step with the jump-none value Duration of a step = Animation duration Number of steps + 1

    The steps() function

  • animation-timing-function: step-start; animation-timing-function: step-end;

    These two values are used with completely different syntax.

    step-start is equivalent to steps(1, start).
    step-end is equivalent to steps(1, end)

Simulator.

The simulator is mainly useful for understanding how the second parameter of the steps() function works. The number of steps is actually fixed at 5. The blue block serves as a reference for comparison.

With values other than jump-none, it sometimes feels like the green block doesn't start from the beginning of its run or doesn't go all the way to the end. This is because the progression starts or ends with a jump rather than a platter.

animation-timing-function :
(default)
steps( 5 )

Browsers compatibility with steps() function.

Animations and the steps() function are well supported by current browsers.

Column 1
Ability to generally support CSS animations.
Column 2
Support for the easing function steps().
1
Animations
support
2
steps()
function
Estimated overall support.
97%
96%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Opéra Mobile

Chrome

Edge

Opéra

Safari

Safari sur IOS

Androïd Brower

Chrome pour Androïd

Firefox pour Androïd

Samsung Internet

Firefox

Baidu Browser

QQ Browser

UC Browser pour Androïd

Opéra mini

Historic of the steps() function.

  • CSS Easing Functions Level 1

    Regarding steps() First definition of the steps() easing function.
    WD
    February 21, 2017
    Working Draft.
    CR
    April 30, 2019
    Candidate Recommendation.
    PR
    REC
  • CSS Easing Functions Level 2

    Regarding steps() No change to the steps() function.
    WD
    August 29, 2024
    Working Draft.
    CR
    PR
    REC

Other easing functions.

The function steps() is described in the module CSS Easing Functions. Note that other easing functions are simple values and not listed below: linear, ease, ease-in, etc.

Functions:

cubic-bezier()
Determines, from 4 parameters, a non-linear progression for animations.
linear()
Defines a linear easing function, usable for animations with animation-timing-function or transition with transition-timing-function.
Steps()
This is an easing function, which defines a jerky progression, step by step.