views:

36

answers:

1

Hi I'm having a display problem with an absolute positioned div in IE6 + IE7
I'm trying to display a drop down menu. this drop down menu is positioned absolute.
now as soon as there's another element below this menu that has position: relative, the absolute positioned drop down menu is displayed behind it. this only happens in IE7 and 6 as mentioned above.

any ideas on how to fix this?

thanks

A: 

The css property z-index is there to let you define what object should be displayed "on top". Define z-indexes for all elements in quest (only drop-down should also work I think).

EDIT (based on provided code):

The element to give the z-index property to is "the topmost element with a position attribute that the overlapped div is not part of. In terms of your sample, give the z-index to menu_container or add it to header and give header position: relative (I like the latter option better because it is less likely to break with future changes of your html).

As for an explanation why this is so, in IE6 and IE7 things work as follows: currently absolute_div is above everything inside menu_container, but menu_container is below relative_div, so absolute_div is too. The reason that header doesn't participate in this story is that if no position attribute is given, what is displayed in front and what is in the back is calculated differently.

Jasper
I've tried to set the z-index but it doesn't work in this case
thanks a lot for your time,i've also found another solution for this (see comment of the actual question)
Erm... no. You found the exact same thing. (the difference being that you found someone who found it didn't work (and found a work around) and who then just shouted "BUG", and I instead logically deduced what was going on...Note that you should still accept an answer - if not mine (or someone else's), then you should post your own answer and accept that.
Jasper