scroll offsethtml
P粉205475538
P粉205475538 2023-08-17 23:52:56
0
1
442
<p>I'm trying to do something in HTML and CSS but not sure if it actually works. </p> <p>I want to make sure I add some kind of "delay" when scrolling, like slowing down the scrolling to make it softer. </p> <p>Some sites do do this, I have visited some pages that scrolled differently than other sites and looked soft. </p> <p>Is this possible? </p>
P粉205475538
P粉205475538

reply all(1)
P粉868586032

sure! To achieve a smooth scrolling effect on your website, you can use the following CSS rules:

html {
  scroll-behavior: smooth;
}

To create internal links that trigger smooth scrolling, use anchor tags like this in your HTML:

<a href="#section1">跳转到第一部分</a>
<a href="#section2">跳转到第二部分</a>

<section id="section1">
  <!-- 第一部分的内容 -->
</section>

<section id="section2">
  <!-- 第二部分的内容 -->
</section>

By using this method, your website scrolling will feel smoother and more comfortable for users.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!