- This topic is empty.
August 17, 2011 at 4:27 pm #33958rappoldParticipant
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?
Would be awesome if someone could help me out with this!August 17, 2011 at 4:46 pm #85151wolfcry911Participant
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:
background: #CBD2D9 url("/test/img/pattern.png") repeat 0 0;
}August 17, 2011 at 4:52 pm #85152rappoldParticipant
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.
- The forum ‘CSS’ is closed to new topics and replies.