Aditya Singh
Aditya Singh

Reputation: 678

Smooth scrolling with CSS or Javascript

My question is that in web page we should apply smooth scrolling with CSS or Javascript. I know how to do it with both , i just want to know that Which would be a better option ?

Upvotes: 1

Views: 1213

Answers (2)

Ashish M J
Ashish M J

Reputation: 700

Use scroll-behavior property in the html element to enable smooth scrolling for the whole page.

html {
  scroll-behavior: smooth;
}

Using JavaScript read this.

Upvotes: -1

Minh Tien
Minh Tien

Reputation: 72

Use css:

scroll-behavior: smooth;

Upvotes: 0

Related Questions