CSS JS

SMOOTH SCROLL WITH CSS & JAVASCRIPT

CSS SMOOTH SCROLL

JUST ADD SMOOTH SCROLL BEHAVIOR TO THE <BODY> <style> html, body { scroll-behavior: smooth; } </style>

JS SMOOTH SCROLL

SCROLL TO THE SPECIFIED X PIXEL ON THE PAGE window.scroll({    top: pix, left: 0,    behavior: 'smooth' });   SCROLL X PIXELS FROM CURRENT POSITION window.scrollBy({    top: pix, left: 0,    behavior: 'smooth' });   SCROLL TARGET ELEMENT WITH GIVEN ID INTO VIEW document.querySelector(id) .scrollIntoView({ behavior: 'smooth' });