Parent element over iframe in IE 7–9

The grotty technique you need to cover up iframe content with elements from the parent page. An iframe is positioned within a parent element and placed behind the child content.

by Jordan

HTML

<div id="outer">
    <div id="inner">my text that should be on top</div>
    <iframe class="cover" src="about:blank"></iframe>
</div>

<iframe id="pdf" src="http://legallo1.free.fr/french/CV_JLG.pdf" width="200" height="200"></iframe>

CSS

#outer {
    position: relative;
    left: 150px;
    top: 20px;
    width: 100px;
    z-index: 2;
}

    #inner{
        background: red;
    }
    
    .cover {
        position: absolute;
        border: none;
        top: 0;
        left: 0;
        height: 100%;
        width: 100%;
        z-index: -1;
    }

#pdf {
    position: relative;
    z-index: 1;
}