The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Filepath-a-palooza (Background image not showing up)

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #33958

    Hello everybody,

    I got an issue about relative file paths in my stylesheet. I refer to this post

    According to the example in the post, I can access the site’s root by starting with “/”, right? Now, I wanna set an image as background but it just doesn’t work as stated in the post.

    It works when I type in “url(../img/pattern.png)” but I want it to be like “url(/img/pattern.png)” (without the two dots) and the post tells me that it should work like that. Am I misunderstanding something here?

    Here’s a link to an example site and this is the hierarchy I’m using

    Would be awesome if someone could help me out with this!


    yes, you’re correct that you can start at root with “/”, but you’ve forgotten that the page and image is within the ‘test’ directory. So what you want is:

    body {
    background: #CBD2D9 url("/test/img/pattern.png") repeat 0 0;

    GOSH!! Stupid me :D Thanks a lot, saves my day! I thought it refers to the sites root (same level as index.html) instead of server root.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.