[thelist] strategies for global css in a local site - abs/rel paths

aardvark roselli at earthlink.net
Tue Mar 5 14:34:01 CST 2002


> From: Sam <sam at sam-i-am.com>
[...]
> Ordinarily this isn't a huge problem as I can use absolute paths. So I
> might reference a background image so:
>  background-image: url(/images/bg.gif);
> .. and both IE and NN are happy.

that's actually root-relative... absolute would be
http://foo.com/images/bg.gif...

> Now, however, I have to come up with a strategy that works for a
> large, deep site that must be browseable locally (cd-rom, desktop,
> whatever) as well as via the server.
[...]

same code, IMO...

if it's a CD-ROM, root relative will work as long as you've got the
site as the root / in the root...

if it's a network drive, map it so the folder with the site is the root of
a mapped drive... so G: might point to \\server1\sites\stuff\ where
'stuff' holds the site...

[...]
> obviously neither of these options is ideal. Am I missing a third,
> slightly-more-ideal solution? This site is likely to be zip and
> emailed, burnt to cd etc. so I have no control over where the user
> choices to locate it. And though I've not yet made the css I can
> almost guarantee there will be background images used (the design will
> be provided, and I have some but not much influence over it)

if done from a zip, yes, you lose control... at which point relative
would be the better way to go, otherwise root-relative should
suffice...

also, if you don't want to call a CSS file with an abosulte path to an
image (or a relative path that would be different on every page),
consider putting that chunk of CSS in the head of every document...




More information about the thelist mailing list