Forums

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
    Posts
  • #33958
    rappold
    Participant

    Hello everybody,

    I got an issue about relative file paths in my stylesheet. I refer to this post https://css-tricks.com/597-quick-reminder-about-file-paths/

    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 http://philipprappold.com/test/ and this is the hierarchy I’m using http://cl.ly/9NQt

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

    #85151
    wolfcry911
    Participant

    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;
    }
    #85152
    rappold
    Participant

    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.