There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

scroll-x

Syntax

scroll-x: (left|right|number of pixels from left) [every (time)] [after (time)][, (left|number of pixels)...];

This command scrolls the target selector left or right. To scroll the window, use the body node as the target selector. To scroll an element, use the target selector of the element you want to scroll.

You target the element that has the overflow, overflow-y or overflow-x set to scroll or auto. The outer container, which would usually have a fixed width that is smaller than the inner container.

The "left" and "right" parameters will scroll to the far left or right. Or you can use the number of pixels parameter, which is the number of pixels from the left that you want to scroll (without the px).

Note: Using the CSS style "scroll-behavior: smooth;" gives us a smooth scroll. Without this there is no scroll animation by default.

scroll-x