Forum Moderators: not2easy

Message Too Old, No Replies

IE6 Doesn't seem to like Absolute URLs in CSS!

         

dan_m2k

8:59 am on Oct 12, 2007 (gmt 0)

10+ Year Member



Hey all,

I'm slightly baffled by the the situation I'm in. I have a nice CSS layout on my page that places a background image as per:


#top-bg{
background:url(/images/top-bg.png) no-repeat 0 0;
...
}

Which works well in Firefox, IE7 et al... However, it *does not* work in IE6 under WinXp. When IE6 loads the page I see in the server logs that it is trying to find the background image at the wrong location relative to the document:

127.0.0.1 - - [12/Oct/2007:09:44:00 +0100] "GET /florals/images/top-bg.png HTTP/1.1" 404 342 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"

However when any other browser trys to load it, everything works fine (a 304 in this case as it's loaded from cache but still works as a 200):


127.0.0.1 - - [12/Oct/2007:09:52:51 +0100] "GET /images/top-bg.png HTTP/1.1" 304 - "http://monkey/css/all.css" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7"

I'm stumped. Either I've messed up the syntax for the absolute URL in the CSS and I'm too blind to see it or something else is going on.
It's worth noting that I am using IE6 in 'standalone' mode, if this makes a difference?

penders

3:02 pm on Oct 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



...the wrong location relative to the document

Just to note (if it helps), relative paths specified in your CSS file are relative to the CSS file and not the HTML document.

Strictly speaking you are using a root-relative path as opposed to an absolute path.

Are you using a BASE element in your HTML document?

It's worth noting that I am using IE6 in 'standalone' mode...

I'm not sure what 'standalone' mode is?

rocknbil

6:35 pm on Oct 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is really odd, I use that syntax all the time - it allows you to call an image from any location in your site without changing it around for subdirectories. I have a machine here with IE 6 for testing.

Is it possibly a server configuration, that is, / is not the root of your viewable domain? What happens to images called that way from a subdirectory?

/test_dir/another_test_dir/test.html contains
<ing src="/images/test.jpg">

dan_m2k

12:19 am on Oct 14, 2007 (gmt 0)

10+ Year Member



So, I'm not nuts (well not because of this at least...)

By 'standalone' mode I mean that I've used the internet explorer 'standalone' installer (Google for it) which allows you to run v3 right up to v6 alongside your default install of IE7. I'm informed it relies on a number of registry hacks to get it working right so I'm pondering if this could be the culprit.

- I don't think it's a server config thing, check out the server log excerpts in my OP.

Thanks

Dan