Search code examples
cssinternet-explorerdebugginginternet-explorer-7haslayout

CSS HasLayout IE7 Bug - Tried Zoom and overflow hidden


Problem I have tried many things to get the position: relative / absolute / fixed working in IE7. I can not work this out now.

.levelTwo is the element that has pos: ab and .levelOne is element that has pos: rel.

So the desired outcome will be any .levelTwo elements to be above/infront of any other elements. Currently they are sitting behind .levelOne a

Markup

    <!-- Bof Level One-->
    <ul class="levelOne">
        <li><a href="#">Basic IT Access <span>&#9658;</span></a>
            <div class="levelTwo">
                jamie
            </div>
        </li>
    </ul>

CSS

.levelOne {
    border-top: 1px solid #DDD;
    list-style: none;
    position: relative;
}

.levelTwo {
    left: 157px;
    position: absolute;
    top: 0;
    background: #FFF;
    height: 40px;
    width: 170px;
    z-index: 10;
    /*tried*/
    display: inline-block;
    *zoom:1;
    overflow:hidden
}

Desired

Desired

Broken

Broken

Heres my fiddle: http://jsfiddle.net/hutber/2GvA4/


Solution

  • Try the below css rules you problem will solve

    CSS:

    .head0 .levelOne li { z-index:60; }
    .head1 .levelOne li { z-index:50; }
    .head2 .levelOne li { z-index:40; }
    .head3 .levelOne li { z-index:30; }
    .head4 .levelOne li { z-index:20; }
    .head5 .levelOne li { z-index:10; }
    
    .levelTwo {
        left: 157px;
        position: absolute;
        top: 0;
        background: #FFF;
        height: 40px;
        width: 162px; /* reduced the width here */
        display: block;
        z-index: 10;
    }
    

    Screen Shot:

    enter image description here

    Reference Links:

    http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html
    http://css-discuss.incutio.com/wiki/Overlapping_And_ZIndex
    http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html
    http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/
    http://www.satzansatz.de/cssd/onhavinglayout.html
    http://www.satzansatz.de/cssd/onhavinglayout.html#rp