[Solar-talk] CSS with image urls
Antti Holvikari
anttih at gmail.com
Mon Dec 25 12:44:12 PST 2006
On 12/25/06, Rodrigo Moraes <rodrigo.moraes at gmail.com> wrote:
> On 12/24/06, Antti Holvikari wrote:
> > You know what, you're right :-). Now that I think of it, the image
> > dirs *should* always be relative to the style dirs.
>
> Browsers follow the CSS specification for url(): the image location is
> relative to the file where the rule is defined (the document for
> inline rules or the stylesheet file). So it is less flexible to use it
> inline: you have to use absolute uri's in url() to be sure it will
> work if the file is included in a different path level.
>
> > So the
> > "../"-thingy works like a charm. Even better, use it like this:
> > "../../Vendor/images/..". This way you make it vendor-aware. Any
> > thoughts?
>
> It's up to you, but I think this would still be a "hardcoded" path. I
> prefer more simple paths because it is easier to pack and avoids
> confusion and messing with image dependencies. Just put /styles and
> /images in the same level (this images dir is meant to be a layout/css
> related images dir). You can organize "themes" and keep things well
> separated and easy to find/manage. This can work for vendors too:
>
> - /Theme1 or /Vendor1
> - /styles - using url(../images/...)
> - /images
> - /Theme2 or /Vendor2
> - /styles - using url(../images/...)
> - /images
>
> It's the best for maintenance and management, in my opinion.
Aren't we talking about the same thing? :-) What I thought in addition
to your example was that you could use images from another vendor with
"../../Vendor/..". This is regarding the suggested "public" dir
structure where vendors have their own dir. But I guess this is what
you meant with "image dependencies". In my case I will need resources
from other public vendor dirs and that "../../" solves my problem.
--
Antti Holvikari <http://phphalo.com>
More information about the solar-talk
mailing list