Stephen Cunliffe wrote:

> Suppose a site has the following structure:
>
> www
>      \things
>      \stuff
>      \other
>      \neat
>              \cool
>
> In the ideal scenario, I'd like to reference one css file
> "site.css" that sits in the root directory.
>
> This works fine, and it will work if I link it in any page,
> nested anywhere in the site.... but....
>
> if one of the styles, has something like:
>
> div.foo{
>  background-image: url(pic.png);
> }
>
> Then it only works, when "loaded" from the "root" directory...

Because that's where the css file is.

> So, the question is, outside of defining several duplicate css
> files (with different paths), or copying the images (there
> would likely be a few), to each and every directory, is there
> a way around this?

Not sure if I understand the question correctly.
Images that are defined in the css file, have to be relative to 
that css file.
If your CSS file is in /foo/bar, and your images are in 
/foo/images, you reference them from your stylesheet as 
url(../images/pic.png); or url(/foo/images/pic.png);, regardless 
of where the html files are that the stylesheet is applied to.

No need to copy images into various directories, they can all 
stay together in one place, just like the CSS file.


-- 
Els
http://locusmeus.com/
http://locusoptimus.com/ 


______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to