Categories
CSS

How to make div move up and down when scrolling the page with CSS?

Spread the love

Sometimes, we want to make div move up and down when scrolling the page with CSS.

In this article, we’ll look at how to make div move up and down when scrolling the page with CSS.

How to make div move up and down when scrolling the page with CSS?

To make div move up and down when scrolling the page with CSS, we make the div position fixed.

For instance, we write

div {
  position: fixed;
}

to make the div’s position fixed so we can make it move as we scroll.

Conclusion

To make div move up and down when scrolling the page with CSS, we make the div position fixed.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *