[thelist] CSS: background images not working

David Dorward evolt at david.us-lot.org
Thu May 23 12:43:01 CDT 2002


On Thu, 23 May 2002 10:27:08 -0700 "Chris W. Parker"
<cparker at swatgear.com> wrote:

> > The syntax looks correct, its a little hard to troubleshoot
> > without a URL though. The only thing I can think of is that you
> > are providing a relative URL based on the location of the HTML
> > document rather then the style sheet.

> ooookkkkk.... so are you saying that i need to reference the image
> from where the stylesheet is located and not from where the document
> that the picture is appearing in is located?

Yes

> i'm doing this on my home computer and am using frontpage to create
> "webs" out of directory's off the root. so for example...

Frontpage... <gulp>

> / - root /css - where my xhtml/css test site is located
> /css/styles/default2.css - where the .css file is located
> /css/images/bgs/bg2.gif - where the background file is located...

> since the index.asp file is in the /css directory (/css/index2.asp)
> and my .css file is in the /css/styles directory
> (/css/styles/default2.css) i should reference the background like
> this?

> background-image: url(/css/images/bgs/bg2.gif);

> whereas before i was doing this...  background-image:
> url(/images/bgs/bg2.gif);

Yes, although I would use genuine relative URLs.

background-image: url('../images/bgs/bg2.gig');

> i was doing that because i thought the webserver would realize that
> /css was the root of that web and not the actual root of the whole
> site i.e.  /

The webserver sends the file that is requested, it only guesses if you
have special modules installed to make the guess - and most don't due
to the extra processing power this requires. If the browser asks for
/images/bgs/bg2.gif then that is what the webserver will look for, not
/css/images/bgs/bg2.gif

> (i think i just got a little confusing there...)

> anyways, i think the problem is that i was referencing it
> wrong. i'll try it when i get home later, or *maybe* at work.

Take a look at the server log files, if you get 404 errors then you
should be able to use them to figure out the problem.

> > HTML email is a bit like using coloured paper and glitter ink on a
> > CV.

> what's a CV?

Americans would call it a resume.

--
David Dorward                                   http://david.us-lot.org/
HTML email is a bit like using coloured paper and glitter ink on a CV.



More information about the thelist mailing list