Hello, I added a background image to my body and set it to fixed but for some reason it scrolls when viewing on mobile. When previewing at a mobile size on desktop it stays fixed but for some reason when it gets to a mobile device the background image scrolls away. Any ideas?
Sure thing - here ya go!
FIxed background images are not supported on mobile devices on iOS.
Can you say more on this? Is there another way to achieve this? I’ve seen websites with fixed backgrounds on mobile before so I assume there’s some way.
You could use fixed positioning for an element with your image inside of it without using background images.
Ahhh, I see. I’ll give that a shot
Lots of people state this answer/response but I don’t think this is true.
I’ve seen multiple sites (like CNBC.com and others) where static ad images are “fixed backgrounds” as you scroll through the website on mobile (iPhones and iPads).
If they’re “not supported”, it wouldn’t be working across the board, right?
So there must be some code they’re assigning/plugging in to make the background fixed in mobile.