Re: Django wont display images on my CSS file

2009-03-28 Thread Nathan Reynolds

On Sat, Mar 28, 2009 at 7:17 AM, Ayaz Ahmed Khan  wrote:

> 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.


Relative URLs in stylesheets aren't a problem these days - I think it
was
Netscape 4 that didn't handle them properly, or maybe an old IE.
Still, no
reason to abstain.

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



Re: Django wont display images on my CSS file

2009-03-28 Thread Ayaz Ahmed Khan


On 28-Mar-09, at 3:14 AM, Dougal Matthews wrote:
>
> 2009/3/27 Brian Neal :
>>
>> 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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django wont display images on my CSS file

2009-03-27 Thread Dougal Matthews

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;

Dougal

---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/




2009/3/27 Brian Neal :
>
> On Mar 27, 7:33 am, Gath  wrote:
>> Guys,
>>
>> Am having a problem in displaying images in my CSS file.
>>
>> I have a css file with the following class
>>
>> .header
>> {
>>  margin-left: auto;
>>  bla bla
>>  bla bla
>>  ...
>> background: url(/site_media/header_background.gif) no-repeat top left;
>>
>> }
>>
>> When i execute the template with this css, no image is displayed!
>> But when i directly inject the background style on my template it
>> works perfect.
>>
>> What am i not doing right!
>>
>
> 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;
>
> Best,
> BN
> >
>

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



Re: Django wont display images on my CSS file

2009-03-27 Thread Brian Neal

On Mar 27, 7:33 am, Gath  wrote:
> Guys,
>
> Am having a problem in displaying images in my CSS file.
>
> I have a css file with the following class
>
> .header
> {
>  margin-left: auto;
>  bla bla
>  bla bla
>  ...
> background: url(/site_media/header_background.gif) no-repeat top left;
>
> }
>
> When i execute the template with this css, no image is displayed!
> But when i directly inject the background style on my template it
> works perfect.
>
> What am i not doing right!
>

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;

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



Re: Django wont display images on my CSS file

2009-03-27 Thread Sean Brant

In most of my projects I have a img, css, js folder. In my css file I
reference images like this url(../img/path/to/img.jpg) in my css
files. The ../ basically says start the path back one directory. Not
sure if this is what's causing your problem.

On Mar 27, 8:10 am, Martin Ostrovsky 
wrote:
> I spoke too soon. Re-reading your comment, it does seem to be entirely
> a CSS/HTML issue - not Django related. Since the inlined style works,
> Django is finding the image.
>
> Sorry about that misleading response.
>
> On Mar 27, 9:07 am, Martin Ostrovsky 
> wrote:
>
> > Without seeing your settings.py file and urls.py, I can only guess,
> > but you probably don't have serving static media setup correctly. If
> > you're running this on the development server, you'll probably see a
> > 404 next to /site_media/header_background.gif in the terminal window.
> > This means Django can't find the image, probably for the reasons I
> > stated above.
>
> > If it says 200 (or 304) next to the filename in the terminal window,
> > then Django has found the image, but your CSS/HTML is the problem.
>
> > Hope that helps.
>
> > - Martin
>
> > On Mar 27, 8:33 am, Gath  wrote:
>
> > > Guys,
>
> > > Am having a problem in displaying images in my CSS file.
>
> > > I have a css file with the following class
>
> > > .header
> > > {
> > >  margin-left: auto;
> > >  bla bla
> > >  bla bla
> > >  ...
> > > background: url(/site_media/header_background.gif) no-repeat top left;
>
> > > }
>
> > > When i execute the template with this css, no image is displayed!
> > > But when i directly inject the background style on my template it
> > > works perfect.
>
> > > What am i not doing right!
>
> > > Gath
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django wont display images on my CSS file

2009-03-27 Thread Martin Ostrovsky

I spoke too soon. Re-reading your comment, it does seem to be entirely
a CSS/HTML issue - not Django related. Since the inlined style works,
Django is finding the image.

Sorry about that misleading response.

On Mar 27, 9:07 am, Martin Ostrovsky 
wrote:
> Without seeing your settings.py file and urls.py, I can only guess,
> but you probably don't have serving static media setup correctly. If
> you're running this on the development server, you'll probably see a
> 404 next to /site_media/header_background.gif in the terminal window.
> This means Django can't find the image, probably for the reasons I
> stated above.
>
> If it says 200 (or 304) next to the filename in the terminal window,
> then Django has found the image, but your CSS/HTML is the problem.
>
> Hope that helps.
>
> - Martin
>
> On Mar 27, 8:33 am, Gath  wrote:
>
> > Guys,
>
> > Am having a problem in displaying images in my CSS file.
>
> > I have a css file with the following class
>
> > .header
> > {
> >  margin-left: auto;
> >  bla bla
> >  bla bla
> >  ...
> > background: url(/site_media/header_background.gif) no-repeat top left;
>
> > }
>
> > When i execute the template with this css, no image is displayed!
> > But when i directly inject the background style on my template it
> > works perfect.
>
> > What am i not doing right!
>
> > Gath
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django wont display images on my CSS file

2009-03-27 Thread Martin Ostrovsky

Without seeing your settings.py file and urls.py, I can only guess,
but you probably don't have serving static media setup correctly. If
you're running this on the development server, you'll probably see a
404 next to /site_media/header_background.gif in the terminal window.
This means Django can't find the image, probably for the reasons I
stated above.

If it says 200 (or 304) next to the filename in the terminal window,
then Django has found the image, but your CSS/HTML is the problem.

Hope that helps.

- Martin

On Mar 27, 8:33 am, Gath  wrote:
> Guys,
>
> Am having a problem in displaying images in my CSS file.
>
> I have a css file with the following class
>
> .header
> {
>  margin-left: auto;
>  bla bla
>  bla bla
>  ...
> background: url(/site_media/header_background.gif) no-repeat top left;
>
> }
>
> When i execute the template with this css, no image is displayed!
> But when i directly inject the background style on my template it
> works perfect.
>
> What am i not doing right!
>
> Gath
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django wont display images on my CSS file

2009-03-27 Thread Gath

Guys,

Am having a problem in displaying images in my CSS file.

I have a css file with the following class

.header
{
 margin-left: auto;
 bla bla
 bla bla
 ...
background: url(/site_media/header_background.gif) no-repeat top left;
}

When i execute the template with this css, no image is displayed!
But when i directly inject the background style on my template it
works perfect.

What am i not doing right!

Gath



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