PDA

View Full Version : MSIE not loading PNG bug.



Citizen
03-16-2006, 03:24 PM
I'm using the AlphaImageLoader filter to load a transparent png as a transparent background from a CSS file. I use some IE hacks to load this PNG in properly in Standards browsers and it works fine.

I ussually put my styles sheets in a /styles directory for easier management. However MSIE will only load the png as a background if the css is in the same directory as the HTML file, not if it is in the /styles sub directory.

Does anyone know why this is and/or how to fix it?

mwinter
03-16-2006, 11:25 PM
I'm using the AlphaImageLoader filter [...]

I ussually put my styles sheets in a /styles directory for easier management. However MSIE will only load the png as a background if the css is in the same directory as the HTML file, not if it is in the /styles sub directory.

Does anyone know why this is and/or how to fix it?When the url() functional notation is used in CSS (for background images, and the like), a relative URL is resolved against the location of the CSS file. However, for some reason, IE bucks this trend with filters and resolves relative URLs against the location of the document that references that CSS file.

Therefore, with a document and CSS file with the following URLs,

  http://www.example.com/html/corporate/about-us.html
  http://www.example.com/css/common.css

the value,

  url(../images/logo.png)

would resolve to:

  http://www.example.com/images/logo.png

but the filter,

  progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/logo.png')

would resolve to:

  http://www.example.com/html/logo.png

Hope that helps,
Mike

Citizen
03-17-2006, 09:13 AM
That's great thanks!

I hadn't even thought of trying that :o...