tags:

views:

29

answers:

2

When I reference an image or other file in a CSS file by a relative path, is the path relative to the CSS file or the HTML file using the CSS file?

A: 

To the CSS file.

emzero
+4  A: 

Yes, it's relative to the .css

Here's an example layout:

Page:  page.htm ... does not matter where
CSS:   /resources/css/styles.css  
Image: /resources/images/image.jpg

CSS in styles.css:

div { background-image: url('../images/image.jpg');
Nick Craver
Perfect, thanks. Just what I needed to know.
George Edison