CSS <axis> Data Type
The <axis> data type is the direction of a scroll timeline: block, inline, x or y. It is used by scroll-driven animations.
Description
The <axis> CSS data type represents the direction of a scroll axis. It is used by scroll-driven animations to decide which scroll direction of a scroll container drives the progress of a timeline. The type accepts two logical keywords, block and inline, and two physical keywords, x and y. You will meet it in properties such as scroll-timeline-axis and view-timeline-axis, and as an argument of the scroll() and view() functions used with animation-timeline.
The logical keywords follow the element's writing-mode. In a normal horizontal writing mode, block is the vertical direction (the way paragraphs stack) and inline is the horizontal direction (the way text runs). If the writing mode is vertical, these swap, so a timeline using block keeps tracking the direction in which content flows. The physical keywords ignore the writing mode: x is always horizontal and y is always vertical. When no axis is given, block is the default.
Choosing the correct axis matters most for horizontally scrolling components such as carousels, image strips and timelines, where the scroll happens along the inline (or x) direction rather than the default block direction.
Examples:
/* Page progress bar driven by vertical scrolling of the root */
.progress {
animation: grow linear;
animation-timeline: scroll(root block);
}
/* A named timeline that tracks horizontal scrolling */
.carousel {
overflow-x: auto;
scroll-timeline-name: --carousel;
scroll-timeline-axis: inline; /* or x */
}
/* An element animating as it crosses a horizontal scroller */
.slide {
animation: fade-in linear both;
animation-timeline: view(x);
}
@keyframes grow {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
Because <axis> only selects a direction, it is usually combined with other scroll-timeline settings such as the scroller (nearest, root or self) and the animation range.
Syntax
<axis> = block | inline | x | y
Values
- blockThe block axis of the scroll container, which is the direction in which blocks of content are stacked. In horizontal writing modes this is the vertical axis. This is the default value.
- inlineThe inline axis of the scroll container, which is the direction in which text runs. In horizontal writing modes this is the horizontal axis.
- xThe horizontal axis of the scroll container, regardless of writing mode.
- yThe vertical axis of the scroll container, regardless of writing mode.
Example
Browser Support
The following information will show you the current browser support for the CSS axis data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





