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-y

Syntax

scroll-y: (top|bottom|number of pixels) [every (time)] [after (time)][, (top|bottom|number of pixels)...];

This command scrolls the target selector up or down. 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 height that is smaller than the inner container.

The "top" parameter is a substitute for 0 - ie. it will scroll the target selector all the way to the top. The "bottom" parameter will scroll the node or element all the way to the bottom. Or use the number of pixels parameter, which is the number of pixels from the top 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-y