Favorites

steps() CSS Function

steps()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The steps() easing function moves an animation in a fixed number of equal jumps instead of smoothly, useful for sprite animations.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The steps() CSS function defines an easing function that moves in a fixed number of equal jumps instead of changing smoothly. The animation holds each value for a while and then jumps to the next, like the hand of a clock that ticks rather than sweeps. It is accepted by animation-timing-function, transition-timing-function and the related shorthands.

The first argument is the number of steps, a positive integer. The optional second argument, the jump term, decides when the jumps happen. jump-end (or end, the default) jumps at the end of each interval, so the final value is reached only when the animation finishes. jump-start (or start) jumps at the start of each interval. jump-none holds both the first and last values, and jump-both adds a jump at both ends. The keywords step-start and step-end are shorthands for steps(1, start) and steps(1, end).

/* Sprite sheet animation with 8 frames */
.sprite {
  background: url("runner.png") 0 0;
  animation: run 0.8s steps(8) infinite;
}

@keyframes run {
  to { background-position: -800px 0; }
}

/* Typewriter effect: reveal one character at a time */
.typing {
  width: 20ch;
  overflow: hidden;
  animation: type 2s steps(20, jump-none);
}

Interactive Demo

linear (for comparison)
the selected timing function
Demo Code
HTML Code
<div class="demo-lanes">
	linear (for comparison)
	<div class="demo-ref"></div>
	the selected timing function
	<div class="demo-element"></div>
</div>
CSS Code
@keyframes demo-ease {
	to { transform: translateX(220px); }
}
.demo-lanes {
	width: 300px;
	padding: 10px;
	box-sizing: border-box;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
	font-size: 12px;
	color: #666;
}
.demo-ref, .demo-element {
	width: 50px;
	height: 40px;
	margin: 4px 0 10px;
	border-radius: 6px;
	animation: demo-ease 2s infinite alternate;
}
.demo-ref {
	background: #c5c5c5;
	animation-timing-function: linear;
}
.demo-element {
	background: #f72585;
	animation-timing-function: steps(4);
}

Syntax

steps() = steps( <integer>, <step-position>? )

<step-position> = jump-start | jump-end | jump-none | jump-both | start | end

Values

  • <integer>The number of equal intervals (steps). Must be greater than 0, or greater than 1 with jump-none.
  • jump-start | startThe first jump happens at the very start of the animation.
  • jump-end | endThe last jump happens at the very end of the animation. This is the default.
  • jump-noneNo jump at either end; the first and last values are each held for one interval.
  • jump-bothJumps happen at both the start and the end, adding an extra step.

Example

<div class="wrap">
<h1>CSS steps() examples</h1>
<div class="grid">
<div class="card">
<div class="track s4"><span class="ball"></span></div>
<div class="label">steps(4)</div>
</div>
<div class="card">
<div class="track s4-start"><span class="ball"></span></div>
<div class="label">steps(4, jump-start)</div>
</div>
<div class="card">
<div class="track s4-none"><span class="ball"></span></div>
<div class="label">steps(4, jump-none)</div>
</div>
<div class="card">
<div class="typing">Typed with steps(22)...</div>
<div class="label">steps(22, jump-none)</div>
</div>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
margin: 24px;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
background: #f5f7fb;
color: #102a43;
}

.wrap {
max-width: 860px;
margin: 0 auto;
}

h1 {
font-size: 20px;
margin: 0 0 16px;
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}

.card {
background: #fff;
border-radius: 12px;
padding: 16px;
box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
font-size: 12px;
color: #486581;
margin-top: 10px;
word-break: break-word;
}

.note {
font-size: 13px;
color: #486581;
margin-top: 14px;
}

/* steps() examples */
.track {
position: relative;
height: 44px;
border-radius: 22px;
background: #e2e8f0;
}

.ball {
position: absolute;
top: 6px;
left: 6px;
width: 32px;
height: 32px;
border-radius: 50%;
background: #2563eb;
animation: slide 2s infinite alternate;
}

@keyframes slide {
to { left: calc(100% - 38px); }
}

.s4 .ball { animation-timing-function: steps(4); }
.s4-start .ball { animation-timing-function: steps(4, jump-start); }
.s4-none .ball { animation-timing-function: steps(4, jump-none); }

.typing {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
font-size: 18px;
width: 22ch;
white-space: nowrap;
overflow: hidden;
border-right: 2px solid #2563eb;
animation: type 3s steps(22, jump-none) infinite alternate;
}

@keyframes type {
from { width: 0; }
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS steps() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.