Updated: 2026-07-11
βοΈ Scroll Behavior Settings
Configure smooth scrolling and scroll margins. Click the buttons below to test.
20px
40px
ποΈ Live Preview
Click buttons to smoothly scroll to each section.
π Section 1
Smooth scrolling makes navigation feel natural. scroll-padding controls the scroll container's inset padding.
π Section 2
scroll-behavior: smooth adds transition animation to all anchor scrolls.
π Section 3
scroll-margin adds extra offset for individual elements, useful when avoiding fixed navigation bars.
π» CSS Code
π CSS scroll-behavior Explained
The scroll-behavior property controls the transition animation when scrolling within an element. With smooth, all anchor jumps and scrollIntoView() calls animate smoothly.
Related Properties
scroll-paddingβ defines inset padding for the scroll containerscroll-marginβ defines individual element margin for anchor offsetscroll-snap-type/scroll-snap-alignβ scroll snapping for carousels