I’m trying to find out why a background image isn’t appearing.
By default, do browsers look for referenced images in the same folder as the style sheet or the script calling the style sheet?
Ex.
Script is /foo/bar.html
Stylesheet is /css/site.css
site.css contains:
.header {background-image: url(beautiful.png);}
Is the browser expecting the file beautiful.png in /foo, or /css?
Also, is it acceptable to reference this image by using the webroot? Ex:
(file in /images/styles/)
.header {background-image: url(/images/styles/beautiful.png);}
It’s relative to the style sheet, not the document:
Root relative paths (leading slash) are fine and what I usually use.