Css position:sticky; doesn't work

I used the position sticky in CSS for my website, and it works fine locally but when I upload it to the 000webhost cloud it doesn’t recognize it at all.
here’s the error I get:

Hi @the-doctor

Where do you see above error?

Sticky positioning is a good feature that comes with HTML 5. But, It’s recommend to use your own JS code to make an element sticky, as position:sticky is not very well supported by browsers.

Example: https://www.w3schools.com/howto/howto_js_navbar_sticky.asp

However, still if you need to use position:sticky this tutorial will help you

2 Likes

thanks! the javascript worked! I’m a bit of a noob when it comes to javascript so maybe you can help me? you see I want two elements to be sticky, the navbar (that works now) and a few pictures. So how would I make those elements sticky too?

@the-doctor

You can do the same to those pictures. If it does not work can you please tell me your web address?

Try this too (I have already mentioned in above reply)

https://www.w3schools.com/howto/howto_css_image_sticky.asp

1 Like