tags:

views:

177

answers:

3

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?

A: 

always put quotes around your url and either the full url("http://example.com/folder/file.htm") or at least the slash url("/file.htm")

isildur4
if there is no spaces, the quotes are NOT needed. Sorry.
BerggreenDK
um, good programing habit?
isildur4
Quotes are totally unnecesasry if there are no spaces, and same applies to full url specifying, why'd you actually want that? CSS reads url's realtive to it's own path. I.E. If your *.css* sits inside `<site root>/styles` and images inside `<site root>/styles/images` you'd use url in CSS like `url(images/<image>.extension)` and it would work perfectly!
Tom
or you could just not be a troll.
isildur4
@isildur4: no, I wouldn't call it "good habit", as you could forget one of the quotes and get even more trouble. Less is more.
BerggreenDK
i c u trohlingi b hateenggtfo my post u newb
isildur4
and tell me why that's ANY LOGICAL REASON to vote DOWN?
isildur4
I totally agree. Paths dont need to be absolute nor do they need to include quotes. Thanks for the input though.
Benjamin Dell
A: 

I havent tests these, but I have a few ideas you should test:

1) How are the files placed on a "local drive" of an iPad? you dont have any HTTP, so I asume you have the image on the "harddrive" (RAM) - try to open the file directly in the browser, does it show/download?

2) Try to add: "display:block;" to your CSS rendering. Might do the trick

3) The IMG tag, try adding width and height, does it change anything?

4) What type of PNG file are you using? 8-bit or 24-bit?

5) What happends if you use a GIF or JPG instead?

BerggreenDK
Thanks for the suggestions. Often it takes a list of simple checks to help sort things out. I am unable to try each of the suggestions out yet, but i am sure it will be one of those (most likely the PNG format i have used on a particular graphic). Thanks for your input.
Benjamin Dell