Skip to content
Advertisement

CSS: How to make sticky element stick not to the top of the page but to a specific pixel or position?

img1

I want the “+01” element to follow the image div while someone is scrolling, but I don’t know how to make it so that it starts moving downwards before it hits the top of the page. Is there a simple solution to this?

Advertisement

Answer

If I understand your question correctly, I think you may be aiming for sticky position. More info

I have made this example based in your image for you. Hope it helps:

JavaScript
JavaScript
Advertisement