HTML smooth scrolling effect using CSS only.
For the past couple of years we all used JS in order to have a scrolling effect, but now we can easily do so with just a single line of code.
For a HTML document, while going from a one end to another end of the page we use #id of the blocks. Then we later use JavaScript to have a smooth scrolling effect with animations and delays.
<section class="features-content" id="features">
...
</section>Now for going into that section, we can use:
<a href="#features">Featues</a>From the above HTML code the link goes to that section of the page, now in order to add a scrolling effect
Here is how we can do it:
html {scroll-behavior: smooth}Now the above code works fine with a downside that it cannot be customized to have a certain time delay, time effect and more.
Currently browser support is not so great, as Safari, Microsoft Edge doesn’t support it.
Keep learning developers.. :)