Menu

Tech tip - Smooth scrolling

I have been adding 'smooth scrolling' to my pages which have internal links.

I add this to my CSS:

:root { scroll-behavior:smooth; }

The browser now shows moving through the page to get to the link.

This even works on Firefox and on the old Chrome for Windows7.

Sometimes the page scrolls very quickly when I come 'back' to a page where I had gone to a link.

I turn 'smooth scrolling' off when the user has asked for 'reduced motion'.

I learnt about this from reading the book: 'Responsive Web Design with HTML and CSS' by Ben Frain. I found the book in a branch of my local library. I find different books in the different branches.

There are more tips at: bbingo.xyz/t

Posted by Bert Beckwith 2025-02-06 Labels: css

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.