Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does IE(7?) distort backgrounds from sprites?

I am pulling my hair out on this one.

We're just about done with the development of an overhaul to our site. As a last step, we're trying to wrap up all the glyphs and icons into a sprite. They're all transparent .png's so the sprite is too. It appears that if a background comes from a sptire, IE distorts it. If it comes from the original file, it does not. FF and Chrome are fine either way.

I am looking at the orignal image and the sprited version side-by-side with grids to see that the pixels are identical. I have counted the pixels in the sprite many times to ensure I'm using the right coordinates. My CSS looks like this:

XXbackground: url(sprite.png) no-repeat 0px -837px; /* lozRedRedSpacer */
background: url(lozRedRedSpacer.png) no-repeat;

The 'XX' lets me toggle back and forth. With the single-file version, it looks perfect: seperate file background. The sprite-version looks like this: sprite. It looks like it is 'squished' both vertically and horizontally. This does not happen in FF or Chrome.

Any ideas?

EDIT I was able to strip out most of the noise and post an example here. I've added notes to the example to describe my problem.

Thank you so much for taking the time to look at this!

UPDATE We've since replaced these 'overlapped divider images' with CSS pseudo-classes that REALLY do overlap and the zooming issue seems to have gone away. Of course now we have new problems - IE8 gets the z-order wrong and IE7 doesn't understand psuedo-elements at all. But at least the markup is simpler and the zooming issue is gone.

like image 500
n8wrl Avatar asked Feb 04 '11 18:02

n8wrl


1 Answers

It turns out my problem was caused by IE's 'zoom' feature. Without any zoom, everything looks great like the other browsers. Even 150% or 200% looks good. But 125%, where I had it, causes this distortion. It happens in IE7 and IE8.

like image 50
n8wrl Avatar answered Oct 20 '22 17:10

n8wrl