SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    555
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to handle paths ?

    Hi,

    My directory structure is like this:

    /
    /css
    /images
    /admin

    I have a css file in /css folder which needs some images which are in the /images folder respectively.
    In /admin folder I am linking that css file. But its not able to get the required images from the /images folder which is outside.

    I need to use that css file both in / and /admin.
    Now i can't go uploading the images in each folder that I use the css file in.

    How do I go about it ? So no matter from where I call the css file, it simply gets the images from /images folder ?

    Thanks.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,588
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Hi Tapan. Yes, this is quite straight forward, and you only need the images in one place. The important thing is to get the path right from your CSS file to the images folder. You can do it in two ways, either:

    url(../images/image.gif)

    or

    url(/images/image.gif)

    I prefer the second method (with the slash at the start), but either is OK.

    The first one meand: "go up one folder, find the images folder there, and find the image.gif file inside that". The second one says: "go to the site's root folder, find the images folder inside that, and find the image.gif file in that".


Bookmarks

Posting Permissions

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