Frontend

HTML5, CSS3 and jQuery tutorials. Also some tools and guides.

Fix / workaround for the z-index problem on IE7

Posted by Danny Herran on Aug 9, 2010 in Frontend | No comments

IE7 behaves strangely when we talk about z-index. It doesn’t always respect the z-index values of our elements. However, if you come around this weird stuff, just add a higher z-index to the parent of the element you want to put above everything else. Don’t ask me why this works but it does!

Lets take a look at a small example:

<div style="z-index: 3000">
  <div style="position:absolute;z-index:1000;">
    this element will appear above everything else
    <a href="#">Page</a>
        ...
  </div>
</div>