Martin McWatters
Martin McWatters

Reputation: 37

CSS scrolling animation when linking to another div?

Here is some basic example code: <a href="#bio">Go to Bio</a> This will just take you to the bio section of the page. Is there a way to make a 'scrolling animation' when linking to this div?

There is a similar question to this but the answer involved JavaScript. I'm wondering if there is a way to do this using only CSS.

Upvotes: 0

Views: 103

Answers (1)

Igor Bykov
Igor Bykov

Reputation: 2812

Sure it's possible.

You are looking for:

html {
  scroll-behavior: smooth;
}

Here is the reference at MDN.

Upvotes: 1

Related Questions