Anonymous 0

My web page opens with an element in the center of the page, and content below it. It scrolls with the rest of the content. However! I think it would be really neat to make that element stop scrolling when it hits the top of the page, and stay there as everything else scrolls?

Can I do this in pure CSS? Do I need JavaScript to check for its location?

1 answer

Kau-Boy 110
2
points

You definatly need javascript for that as there is only a position fixed but not a "stop at the bottom of the viewport" css property.

Answered almost 9 years ago by Kau-Boy