One CSS rule for smooth jumps to page sections, which switches off for visitors who prefer reduced motion.
@media (prefers-reduced-motion: no-preference) {
html {
scroll-behavior: smooth;
}
}
Clicking a “Jump to section” link or a table of contents normally snaps instantly to the target. Smooth scrolling animates the jump, so visitors can see where they’ve moved to on the page.
scroll-behavior: smooth on the html element tells the browser to animate every in-page jump: anchor links, #hash URLs and scripts that scroll to an element.
The rule sits inside prefers-reduced-motion: no-preference, so people who’ve asked their device to reduce motion, often because animation makes them feel unwell, still get instant jumps.
Add a link like <a href="#comments"> to a post and click it. The page should glide down instead of jumping.