3 replies [Last post]
royatl
Offline
newbie
Last seen: 15 years 29 weeks ago
Timezone: GMT-5
Joined: 2004-04-03
Posts: 3
Points: 0

I'm using the following code:

#centerpart
{
margin: 0px 97px 0px 97px;
padding: 0px;
background-image: url(dscn1237.jpg);
color: #fff;
height: 300px;
}

IE6 displays the background image as I expect, but Firefox 0.8 and Opera 7.11 do not. Is there something I'm missing?

Roy

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 4 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Background-image problems

Hi royatl,
The only thing I can think of is the path to the image may be interpreted differently by different browsers.

Paths are meant to be relative to the style sheet but I think it's IE that reads them from the page. So if the CSS file and page are in different directories you can either copy the image into both directories or use an absolute path.

If they are all in the same directory please supply a link so we can have a closer look.

Hope that helps

royatl
Offline
newbie
Last seen: 15 years 29 weeks ago
Timezone: GMT-5
Joined: 2004-04-03
Posts: 3
Points: 0

Background-image problems

well, I set my doctype to 4.01 strict, and now IE6 does the same thing that Opera and Firefox are doing... no images.

The paths are relative to the root dir, which is where both the page and the css are, though I've tried all these forms, to no effect:

\image\pic.jpg
.\image\pic.jpg
image\pic.jpg

I'll set up an example later this afternoon.

royatl
Offline
newbie
Last seen: 15 years 29 weeks ago
Timezone: GMT-5
Joined: 2004-04-03
Posts: 3
Points: 0

Background-image problems

Fixed! It was the path separator. Needed to be in *nix form.