SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Kysmiley's Avatar
    Join Date
    Dec 2004
    Isonville KY
    0 Post(s)
    0 Thread(s)

    relative path for backgrounds

    Im having a difficult time to set the background images with relative paths. For some reason i have not figured out, on some CSS i can use relative and others will not accept it even though everything is the same in both the locations of the images and the css files are the same the only difference is the name of the css files. I also have a test server on my laptop and I am not able to use a relative path with it yet all the other images I can. Heck on the test bed i have to set the path pointing to my on-line server so the background images will show up. Funny part is im in a truck moving down the road not even connected to the net yet the relative path wont work
    Any ideas on why

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Hampshire UK
    183 Post(s)
    6 Thread(s)

    Usually these problems boil down to a few simple things that need to be checked.

    1) The relative path to the image from the css stylesheet is relative to the css stylesheet and not the html page that called it. Make sure the image paths are relative to where you put the stylesheet. If you move the stylesheet into different directory then the path will be broken.

    2)The image name is not spelled correctly or wrong path specified.

    3)The structure offline is not the same as online or you have specified absolute addresses e.g. http:etc...

    Some people like to set root relative paths so that they can keep track of things better. e.g. url(/assets/images/image.gif). The fits forward slash means start at the root of the site and drill down which means the resource will always be found no matter where its caled from within the structure.

    Of course your problem may be none of these and unless you can provide a working example of the problem it may be hard to pinpoint exactly.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts