Take the 2-minute tour ×

I am having the classic problem, my header navigation bar is going under my iframe in the body, but my attempt at solving this with z-indexes has just left me more confused and still with the same problem :/ Here is my setup:

<header style="z-index:2;">
<nav align="center" style="z-index:2;">
<section id="content" style="z-index:-1;">
<div class="block">
    <div class="main">
    <!--[if IE]>
<div style="z-index:-2;">
<iframe width="900" height="900" style="position:relative; z-index:-2;" src="http://www.flytheflagtexas.com/athens/magazine/latest/index.html" ></iframe>

Why wont the z-index:-2 iframe appear under anything? Here is the page: http://www.flytheflagtexas.com/athens/latest feel free to go through the code

share|improve this question
Perhaps repeat question of: stackoverflow.com/questions/6242034/… –  Andy Oct 31 '12 at 15:39
z-indexes are relative only to containers. your -1 is in a different block than the 2 –  Marc B Oct 31 '12 at 15:40
how do I make the header block appear over the section block then? –  King Oct 31 '12 at 15:47

3 Answers 3

up vote 2 down vote accepted

z-index works only if you have given used positions for laying out the components. Otherwise it just doesn't work. This means that z-index Applies to: positioned elements

share|improve this answer
it is still not working –  Hemen Ashodia Oct 31 '12 at 15:59
@HemenAshodia: You should give position to your parent div of iframe. btw king posted the question and where did you try the solution. –  defau1t Oct 31 '12 at 18:34
on his website i made changes in my computer –  Hemen Ashodia Nov 1 '12 at 8:31

Try this:

#nav{position:relative; z-index:2;}

and for the frame


You don't need to give a z-index value to the bottom element, but you can, just make it less then 2.

share|improve this answer

Z-index only works reliably when you use

position: relative; 


position: absolute;

If you don't set position in CSS to one of the supported values, z-index won't have any effect.

share|improve this answer

Your Answer


