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

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.