Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8697041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:25:11+00:00 2026-06-13T01:25:11+00:00

I cannot get z-index working on a iframe that contains a pdf file with

  • 0

I cannot get z-index working on a iframe that contains a pdf file with IE8. It works with Google Chrome.

Example (JSFiddle):

HTML

<div id="div-text">
      <div id="shouldBeOnTop">my text that should be on top</div>
</div>
<div id="div-frame">
    <iframe src="http://legallo1.free.fr/french/CV_JLG.pdf" width="200" height="200"/>
</div>

CSS

#div-text{
    position:relative;
    left:210px;
    top:20px
}

#shouldBeOnTop{
    position:relative;
    right:60px;
    background-color:red;
    width:100px;
    z-index:2;
}

#div-frame{
    position:relative;
     z-index:1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:25:12+00:00Added an answer on June 13, 2026 at 1:25 am

    Update: Matthew Wise has a really clever alternative solution which you should consider—especially if you’re having trouble with my approach or dislike ugly hacks!


    There is a way to cover windowed elements in IE with other elements, but you’re not going to like it.

    Background: windowed and windowless elements

    Legacy IE categorises elements into two types: windowed and windowless.

    Regular elements like div and input are windowless. They are rendered by the browser itself in a single MSHTML plane and respect each other’s z-order.

    Elements rendered outside of MSHTML are windowed; for example, select (rendered by the OS) and ActiveX controls. They respect each other’s z-order, but occupy a separate MSHTML plane that is painted on top of all windowless elements.

    The only exception is iframe. In IE 5, iframe was a windowed element. This was changed in IE 5.5; it is now a windowless element, but for backwards compatibility reasons it will still draw over windowed elements with a lower z-index

    In other words: iframe respects z-index for both windowed and windowless elements. If you position an iframe over a windowed element, any windowless elements positioned over the iframe will be visible!

    What this means

    The PDF will always be painted on top of the regular page content—like select elements were until IE 7. The fix is to position another iframe between your content and the PDF.

    Demo

    jsFiddle: http://jsfiddle.net/Jordan/gDuCE/

    Code

    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 {
            border: none;
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            z-index: -1;
        }
    
    #pdf {
        position: relative;
        z-index: 1;
    }
    

    Support

    This has been tested and should work in IE 7–9. If you feel persnickety about it showing up in the DOM for other browsers, you can add it with JavaScript or wrap it in an IE-only conditional comment:

    <!--[if IE]><iframe class="cover" src="about:blank"></iframe><![endif]-->
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot get my SID working ... <?php session_start(); // Or maybe pass along
I cannot get the example Python programs to run. When executing the Python command
I'm new to ASP.NET MVC (working with version 3) and cannot get ActionLink or
I cannot get the Full-Text search to work on PDF files I am loading
Alright, I've been working on this for a while and cannot get it. I'm
I cannot get my Wordpress theme to randomise the posts I'm displaying in the
I cannot get my Spring web app to find my scripts. I have the
I cannot get this function to fire off... I'm thinking I need a fresh
I cannot get Bindable LINQ to work with VB.NET for the life of me.
I cannot get the background to stretch behind the contentbox. The strange thing is,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.