Z-index: don’t expect me to be working without no positioning!

Posted Jan 19th, 2009 by David Calhoun in css

I’m thinking of starting a section for “D’oh Moments” - aka moments where I made a simple mistake but it took me an unusually long time to solve the problem.

In this case it’s z-index, which I was trying to implement to fix a problem on IE (where most of the problems end up being, as you know).  The problem is that z-index had absolutely not effect.  D’oh!  That’s because one element wasn’t being positioned.  Simply apply this tag:

position: relative;

Apply that to whatever you’ve positioning with z-index, and voila, z-index magically works!  Noob mistake caused by me not reading the documentation close enough…

Trackback URI | Comments RSS

Leave a Reply

Categories