0

so evidently according to this Using relative URL in CSS file, what location is it relative to?, css that is loaded from the link tag references files in relation to the folder that the css file is in...

so here's my directory structure:

httpdocs/
     css/
         thecss.css
         bg.png

so thecss.css contains the following entry

#guinea {background-image:url(bg.png)}

but the problem is...the image is not showing up even though it's in the exact same directory with the css....

on the other hand if I change it to this:

#guinea {background-image:url(http://localhost/css/bg.png)}

it would work!

using url(/css/bg.php) doesn't work either...

what am I doing wrong? why is my relative url include not working?

Community
  • 1
  • 1
kamikaze_pilot
  • 14,304
  • 35
  • 111
  • 171

1 Answers1

0

I would say it's best to separate your images and your styles.

So place your bg.png in an images folder and reference it as so...

#guinea {background-image:url(../images/bg.png)}

Jason Gennaro
  • 34,535
  • 8
  • 65
  • 86