Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the speed of the smooth scrolling with CSS?

Tags:

html

css

scroll

I'd like to scroll to the bottom of the page and I recently found the scroll behavior style tag. Is there a way to change the speed of smooth scrolling using a CSS style?

Related question (using JQuery): How to change speed of a smooth scroll?

like image 286
1.21 gigawatts Avatar asked May 10 '19 00:05

1.21 gigawatts


People also ask

How do I make my scroll-behavior smooth in CSS?

The scroll-behavior property accepts two values, which essentially toggle the smooth scrolling feature on and off. auto (default): This value allows the abrupt jump between elements within the scrolling box.

How do I scroll smoothly?

If you press the mouse scroll wheel, you can move your mouse up/down and the scroll will be very smooth. Enabling a smooth scroll allows you to scroll like that with your regular wheel scroll. Smooth scrolling is also useful with keyboard shortcuts.

Can I change the scroll speed using CSS or jQuery?

The scroll speed CAN be changed, adjusted, reversed, all of the above - via javascript (or a js library such as jQuery). WHY would you want to do this? Parallax is just one of the reasons.

How do I make my href scroll smoother?

The hash portion of the anchor link is first extracted using the hash property and it is selected with the querySelector() method. The scrollIntoView() method is then called on this selected element to smoothly scroll the page to this location. Example: HTML.


1 Answers

No, the smooth scrolling speed cannot be changed using CSS. The only attribute tags available are behavior tags; smooth/auto.

like image 127
lxnaris Avatar answered Sep 20 '22 16:09

lxnaris