- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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!
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.