1

I have the following CSS in order to get an image on my page background, and a color around it.

#home{text-align:center;background:Red url('/Content/image.png') no-repeat fixed center;}

When I run it on my computer with any browser (I prefer Chrome), everything is fine. However, when I open the website on my phone (also using Chrome), I only see the background color, not the image. However, as soon as I remove the center part (background position), I can see it.

Any idea?

user304429
  • 11
  • 1
  • 6

3 Answers3

3

After some searching, I found that images wider than 1024px don't display on iDevices. I used a media query to change the background, like this:

@media all and (max-width:900px), (max-device-width:900px){
body{
background-image: url('smaller-image.gif');
}
}

Hope that helps someone.

Julian K
  • 1,877
  • 2
  • 19
  • 27
  • I've been messing around with my CSS for hours now trying to get a background image to display on iOS7 or older devices with no luck. I changed my image to 1024px in width (from 3000px) and now it works. Thank you so much! – GuerillaRadio Sep 30 '15 at 10:34
1

I faced a same problem, then I applied background:url("../img/pic1.jpg") no-repeat center; its working you can try if you faced problem in ios.

チーズパン
  • 2,752
  • 8
  • 42
  • 63
Haseeb Tariq
  • 55
  • 1
  • 11
1

Nowadays it doesn't really matter whether picture is wider than 1024px. The issue for me that caused not displaying background-image was: background-attachment: fixed;

In this case, just change this line to background-attachment: scroll; with @media query

Rachel Nicolas
  • 995
  • 2
  • 12
  • 20