When defining something like a background image URL in a CSS file, when using a relative URL, where is it relative to? For example:
Suppose the file /stylesheets/base-styles.css
contains:
div#header {
background-image: url('images/header-background.jpg');
}
If I include this style-sheet into different documents via <link ... />
will the relative URL in the CSS file be relative to the stylesheet document in /stylesheets/
or relative to the current document it's included to? Possible paths like:
/item/details.html
/about/index.html
/about/extra/other.html
/index.html
One issue that can occur, and seemingly break this is when using auto minimization of css. The request path for the minified bundle can have a different path than the original css. This may happen automatically so it can cause confusion.
The mapped request path for the minified bundle should be "/originalcssfolder/minifiedbundlename" not just "minifiedbundlename".
In other words, name your bundles to have same path (with the /) as the original folder structure, this way any external resources like fonts, images will map to correct URIs by the browser. The alternative is to use absolute url( refs in your css but that isn't usually desirable.
Taken from the CSS 2.1 spec.