On 28-Mar-09, at 3:14 AM, Dougal Matthews wrote:
>
> 2009/3/27 Brian Neal <[email protected]>:
>>
>> I seem to recall that when you put references to files in your
>> CSS, they are relative to that CSS file, not to the document
>> root. So if that graphic file is in the same directory as your
>> CSS file, change your url to:
>>
>> background: url(header_background.gif) no-repeat top left;
>>
> Isn't it just because you don't have quotes around the image address?
>
> background: url('/site_media/header_background.gif') no-repeat top  
> left;

The CSS specification[0] dictates that the surrounding quotes--be they
single or double--within the url() notation for describing URLs are
optional. Furthermore, it stipulates that if the given URL path is
relative, the absolute path is derived at by combining that relative
path with a base URL which, for CSS style sheets, is the base URL for
the style sheet. However, your guess is as good as mine about which
popular browsers adhere to that latter specification, in particular,
and which don't. Having said that, I should mention that I have in
web projects that I have worked on before, where style sheets were
kept within /static/css/ and the accompanying images in /static/images,
specified URLs for images within the CSS style sheets via URLs of the
form `/static/images/file.ext`, and found them to seamlessly work across
a diverse set of browsers.

[0] http://www.w3.org/TR/CSS2/syndata.html#uri

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to