From the course: CSS: Scrolling and Parallax

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Smooth scrolling on link clicks

Smooth scrolling on link clicks - CSS Tutorial

From the course: CSS: Scrolling and Parallax

Smooth scrolling on link clicks

- [Narrator] Let's say you want to make the scrolling of your links a little bit smoother. So right now, when we click on this, it takes you to this section called meet the monsters, that's further down on the page, but it jumps to it immediately. And one way to fix this is by using a special property called scroll behavior. Now, as you can see, in caniuse.com scroll-behavior isn't well implemented in all browsers right now, but it's the sort of thing that is so easy to do than, I think you can use it right now, and then when newer websites accept this feature, it will be automatically added into them. So, let's take a look at how this works. So, the way that this works is you add a scroll behavior property, the default behavior is auto. So, you want to set that to smooth and you want to do that in the HTML element and tag it as important so that it overrides everything. So, let's see how that works. Switch back over…

Contents