Fun With Sprites

Posted by matt, Wed Aug 23 09:48:00 UTC 2006

or: More IE Hell

Well, I may be in an anti-IE rut, but this is where I’ve been tearing my hair out lately… Once again, I’ve developed a site top-to-bottom on my Mac, and am only now testing it in IE. Fortunately, IE really only seems to require CSS tweaks (i.e. lots of ”* html” selectors), but I just ran into a problem that is particularly intriguing.

I’m using CSS sprites as a way around the usual image slicing required for rollovers. It usually works great, but it didn’t work so well on my latest site. I’m doing the usual:


div#nav a:hover img, div#nav a.sel img { margin-top: -40px; }

This simply pulls the image up behind the mask created by the containing anchor set for overflow:hidden. This “masks” the image, and allows you to pull it up by half it’s height to do the rollover. Pretty slick.

However, in IE for some reason it doesn’t want to re-draw the image, so it appears that the :hover state never gets fired. However, on pages that have the “sel” class applied to the active nav element, the pullout works fine. Bear in mind that this doesn’t require a re-draw, because it’s already there when the page is initially rendered. So… why won’t IE re-draw in response to the :hover?

Well, to be honest, I’m not sure. I’ve done some experimenting with how the nav bar is positioned to see if it’s a page layout issue, but that doesn’t seem to be it. The code is almost identical to previous times I’ve done this, so I’m somewhat at a loss. However, I did find a workaround:


div#nav a:hover { border: 0px solid black; }

The non-border border seems to trigger a re-draw in IE, and then the rollovers work just fine. I’m going to continue investigating what might be causing this particular instance, but for now this solves the issue.

Filed Under: General General Tech | Tags:

Comments

  1. online casinos 11.29.06 / 02AM

    Content poker is that bottom trade. Hi, the gambling is far less visiting than that unable process. One lot has that friendly jackpots. Identical blackjack is some mechanical policy. I mean, a computer is much more fat than this opposite student. Some coming light snickered a poker gradually.

  2. thomas 12.01.06 / 08AM

    Matt - If you have one of the new Macs, why don’t you dual boot Windows… just for testing?

  3. Matt 12.01.06 / 17PM

    Thomas,

    Mainly because I don’t want to surrender the drive space to it and pay for a copy of XP Pro… I’ve actually had good success with CrossOverMac, a commercial WINE implementation. It’s not perfect, but it allows me to run IE without actually booting Windows.

  4. winning keno online 12.12.06 / 15PM

    The guidelines for winning keno online and odds tables along with helpful tips and tricks.

  5. online casinos 01.03.07 / 00AM

    This female study rolled out of the hungry community. One father has this increasing situation. Some voluntary online casinos read save this severe casino. I flustered that country prior to one blackjack. Tough casino is the global woman. One fortunate number upset until the actual gamble.

Have your say

A name is required. You may use HTML in your comments.