AlexMorley-Finch AlexMorley-Finch - 1 year ago 110
CSS Question

CSS root directory

I have a style sheet where I include background images.

background: url(../Images/myImage.png);

problem is, pages from different directories use this css!

My CSS files are in a CSS folder, images in an Image folder, and my html pages are in many different folders depending on their content and meaning to the website.

All my pages inherit this css as it is the MAIN theme.

The path used in the above example is a relative path. And obviously, this path only works for some of the pages. ALL i need is to link the images in the css from the ROOT folder. Therefore every path is correct no matter where the file is in the folder structure!

I have tried:


I don't think a root folder selector exists... but I hope it does :/

Answer Source

this has to be in root of your domain/subdomain

and it will work

However, I think it would work like this, too

  • images
    • yourimage.png
  • styles
    • style.css


    background: url(../images/yourimage.png);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download