Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS background images not showing on the ipad

Tags:

css

I'm totally confused and wondering whether i'm just missing something simple, but i am unable to display a background image on an ipad or within the ipad simulator.

As a test i put together the following simple page:

<html>
<head></head>
<body>
    <img src="content_box_black_background.png" />
    <div style="height: 100px; width: 500px; background:url(content_box_black_background.png);">
    </div>
</body></html>

As a test I am also outputting the image directly above the div block. In chrome they both appear but in the ipad simulator neither do. Any ideas?

like image 560
Benjamin Dell Avatar asked Jul 23 '10 14:07

Benjamin Dell


Video Answer


2 Answers

It could be related to the dimensions of the image. The Safari Web Content Guide mentions that the maximum size for GIF, PNG and TIFF images is 3 megapixels (3 * 1024 * 1024). I ran into a similar issue displaying a menu based on CSS sprites. I had to shrink the rather large image (3000x1500) before any of the sprites would display on the iPad.

like image 87
timbonicus Avatar answered Sep 23 '22 13:09

timbonicus


IPAD doesn't like cover in background shorthand. If you are using cover do it on a new line

   -webkit-background-size: cover; 
   -moz-background-size: cover; 
   -o-background-size: cover; 
     background-size: cover;
like image 25
Rick Avatar answered Sep 25 '22 13:09

Rick